数据结构与算法基础-学习-27-图之最短路径之Dijkstra(迪杰斯特拉)算法

news2024/11/16 1:55:08

一、最短路径应用案例

例如从北京到上海旅游,有多条路可以到目的地,哪条路线最短,哪条路线最省钱,就是典型的最短路径问题。

二、最短路径问题分类

最短路径问题可以分为两类,第一类为:两点间最短路径。第二类为:某源点到其他各点最短路径。不同的问题类型可以用不同的算法实现,本文介绍第一类问题的Dijkstra算法实现。

三、Dijkstra算法思路

50adfac874ac4a9297533fd8ed5ffc26.png

这次新画了一个图,是时候体现一下画图技巧啦,言归正传,我们需要用有向图加邻接矩阵实现,邻接矩阵结果如下:

[2023-7]--[ Debug ]--Printf AMGraph                     :
VertexArray    : [0 ,1 ,2 ,3 ,4 ,5 ,6 ]
ArcArray       :
[32767 ,13    ,8     ,32767 ,30    ,32767 ,32    ]
[32767 ,32767 ,32767 ,32767 ,32767 ,9     ,7     ]
[32767 ,32767 ,32767 ,5     ,32767 ,32767 ,32767 ]
[32767 ,32767 ,32767 ,32767 ,6     ,32767 ,32767 ]
[32767 ,32767 ,32767 ,32767 ,32767 ,2     ,32767 ]
[32767 ,32767 ,32767 ,32767 ,32767 ,32767 ,17    ]
[32767 ,32767 ,32767 ,32767 ,32767 ,32767 ,32767 ]
CurVertexNum   : 7
CurArcNum      : 10

除此之外我们还需要维护一个最短边数组LowestEdgeArray和点到点路径长度数组PathLenArray,如下:

[2023-7]--[ Debug ]--Printf StDijkstra
LowestEdgeArray    :
  0 : (EndVertextIndex :   1, WeightVal :    13), [ (0,1,13) ]
  1 : (EndVertextIndex :   2, WeightVal :     8), [ (0,2,8) ]
  2 : (EndVertextIndex :   3, WeightVal : 32767), [ ]
  3 : (EndVertextIndex :   4, WeightVal :    30), [ (0,4,30) ]
  4 : (EndVertextIndex :   5, WeightVal : 32767), [ ]
  5 : (EndVertextIndex :   6, WeightVal :    32), [ (0,6,32) ]
PathLenArray       : [ (0,2,8) ]
PathLenArrayLen    : 1
PathLenArrayMaxLen : 6

我们从0点出发,先解释一下上图如何理解:

第一行表示:最短边数组LowestEdgeArray索引号0存储着顶点索引:0到结束点EndVertextIndex:1,权值为13,后面的[ (0,1,13) ]可以不关注,主要是为了实现例如0->4,经过了哪些点,方便计算用的。

第二行表示:最短边数组LowestEdgeArray索引号1存储着顶点索引:0到结束点EndVertextIndex:2,权值为8。

后面几行也以此类推,就是在邻接矩阵图上遍历。

填写好0到5行最短边数组LowestEdgeArray数据后,计算其中最小的权值8,对应EndVertextIndex:2,并记录点到点路径长度数组PathLenArray中。2号节点被我们找到了,后面遍历1-6号节点时,不需要扫描2号点了。

我们取到的是(0,2,8),现在我们将邻接矩阵中2号点的计算并更新到最短边数组LowestEdgeArray。

[32767 ,32767 ,32767 ,5     ,32767 ,32767 ,32767 ]

我们只需要看2->3的权值5,5+8(之前取到的最小权值)<32767,因为其他点都是无穷大,但实际计算是需要挨个比较的。

 2 : (EndVertextIndex :   3, WeightVal : 32767), [ ]

更新为13,在开始找最小权值从1,3,4,5,6中扫描。

  2 : (EndVertextIndex :   3, WeightVal :    13), [ (2,3,5) ]

更新最短边数组LowestEdgeArray和点到点路径长度数组PathLenArray,如下:

[2023-7]--[ Debug ]--Printf StDijkstra
LowestEdgeArray    :
  0 : (EndVertextIndex :   1, WeightVal :    13), [ (0,1,13) ]
  1 : (EndVertextIndex :   2, WeightVal :     8), [ (0,2,8) ]
  2 : (EndVertextIndex :   3, WeightVal :    13), [ (2,3,5) ]
  3 : (EndVertextIndex :   4, WeightVal :    30), [ (0,4,30) ]
  4 : (EndVertextIndex :   5, WeightVal : 32767), [ ]
  5 : (EndVertextIndex :   6, WeightVal :    32), [ (0,6,32) ]
PathLenArray       : [ (0,2,8),(0,1,13) ]
PathLenArrayLen    : 2
PathLenArrayMaxLen : 6
PathLenArray       : [ (0,2,8),(0,1,13) ]

现在只需要扫描3,4,5,6节点信息,上一个最小权值是在1号节点,把邻接矩阵中1号点的信息写入并计算。

[32767 ,32767 ,32767 ,32767 ,32767 ,9     ,7     ]

13 < 13 + 32767,LowestEdgeArray中EndVertextIndex:3的权值13小于上一个最小值(0,1,13)的13加上邻接矩阵3号位权值32767,不更新LowestEdgeArray。

30 < 13 + 32767,LowestEdgeArray中EndVertextIndex:4的权值30小于上一个最小值(0,1,13)的13加上邻接矩阵4号位权值32767,不更新LowestEdgeArray。

32767 > 13 + 9,LowestEdgeArray中EndVertextIndex:5的权值32767 大于上一个最小值(0,1,13)的13加上邻接矩阵5号位权值9,更新LowestEdgeArray的EndVertextIndex :   5的权值位22。

32 > 13 + 7,LowestEdgeArray中EndVertextIndex:6的权值32 大于上一个最小值(0,1,13)的13加上邻接矩阵6号位权值7,更新LowestEdgeArray的EndVertextIndex :   6的权值位20。

上面4个点中找出最小权值13,(0,3,13)写入到PathLenArray中,具体变化如下:

[2023-7]--[ Debug ]--Printf StDijkstra
LowestEdgeArray    :
  0 : (EndVertextIndex :   1, WeightVal :    13), [ (0,1,13) ]
  1 : (EndVertextIndex :   2, WeightVal :     8), [ (0,2,8) ]
  2 : (EndVertextIndex :   3, WeightVal :    13), [ (2,3,5) ]
  3 : (EndVertextIndex :   4, WeightVal :    30), [ (0,4,30) ]
  4 : (EndVertextIndex :   5, WeightVal :    22), [ (1,5,9) ]
  5 : (EndVertextIndex :   6, WeightVal :    20), [ (1,6,7) ]
PathLenArray       : [ (0,2,8),(0,1,13),(0,3,13) ]
PathLenArrayLen    : 3
PathLenArrayMaxLen : 6

现在只需要扫描4,5,6节点信息,上一个最小权值是在3号节点,把邻接矩阵中3号点的信息写入并计算。

[32767 ,32767 ,32767 ,32767 ,6     ,32767 ,32767 ]

30 > 13 + 6,LowestEdgeArray中EndVertextIndex:4的权值30大于上一个最小值(0,3,13)的13加上邻接矩阵4号位权值6,更新LowestEdgeArray的EndVertextIndex :   4的权值位19。

22 < 13 + 32767,LowestEdgeArray中EndVertextIndex:5的权值22 小于上一个最小值(0,3,13)的13加上邻接矩阵5号位权值32767,不更新LowestEdgeArray。

20 < 13 + 32767,LowestEdgeArray中EndVertextIndex:6的权值20 小于上一个最小值(0,3,13)的13加上邻接矩阵6号位权值32767,不更新LowestEdgeArray。

上面3个点中找出最小权值19,(0,4,19)写入到PathLenArray中,具体变化如下:

[2023-7]--[ Debug ]--Printf StDijkstra
LowestEdgeArray    :
  0 : (EndVertextIndex :   1, WeightVal :    13), [ (0,1,13) ]
  1 : (EndVertextIndex :   2, WeightVal :     8), [ (0,2,8) ]
  2 : (EndVertextIndex :   3, WeightVal :    13), [ (2,3,5) ]
  3 : (EndVertextIndex :   4, WeightVal :    19), [ (3,4,6) ]
  4 : (EndVertextIndex :   5, WeightVal :    22), [ (1,5,9) ]
  5 : (EndVertextIndex :   6, WeightVal :    20), [ (1,6,7) ]
PathLenArray       : [ (0,2,8),(0,1,13),(0,3,13),(0,4,19) ]
PathLenArrayLen    : 4
PathLenArrayMaxLen : 6

现在只需要扫描5,6节点信息,上一个最小权值是在4号节点,把邻接矩阵中4号点的信息写入并计算。

[32767 ,32767 ,32767 ,32767 ,32767 ,2     ,32767 ]

22 >19 + 2,LowestEdgeArray中EndVertextIndex:5的权值22 大于上一个最小值(0,4,19)的19加上邻接矩阵5号位权值2,更新LowestEdgeArray的EndVertextIndex :   5的权值位21。

20 < 19 + 32767,LowestEdgeArray中EndVertextIndex:6的权值20 小于上一个最小值(0,4,19)的19加上邻接矩阵6号位权值32767,不更新LowestEdgeArray。

上面2个点中找出最小权值20,(0,6,20)写入到PathLenArray中,具体变化如下:

[2023-7]--[ Debug ]--Printf StDijkstra
LowestEdgeArray    :
  0 : (EndVertextIndex :   1, WeightVal :    13), [ (0,1,13) ]
  1 : (EndVertextIndex :   2, WeightVal :     8), [ (0,2,8) ]
  2 : (EndVertextIndex :   3, WeightVal :    13), [ (2,3,5) ]
  3 : (EndVertextIndex :   4, WeightVal :    19), [ (3,4,6) ]
  4 : (EndVertextIndex :   5, WeightVal :    21), [ (4,5,2) ]
  5 : (EndVertextIndex :   6, WeightVal :    20), [ (1,6,7) ]
PathLenArray       : [ (0,2,8),(0,1,13),(0,3,13),(0,4,19),(0,6,20) ]
PathLenArrayLen    : 5
PathLenArrayMaxLen : 6

现在只需要扫描5节点信息,上一个最小权值是在6号节点,把邻接矩阵中6号点的信息写入并计算。

[32767 ,32767 ,32767 ,32767 ,32767 ,32767 ,32767 ]

21 < 20 + 32767,LowestEdgeArray中EndVertextIndex:5的权值21 小于上一个最小值(0,6,20)的20加上邻接矩阵6号位权值32767,不更新LowestEdgeArray。

上面1个点中找出最小权值20,(0,5,21)写入到PathLenArray中,具体变化如下:

[2023-7]--[ Debug ]--Printf StDijkstra
LowestEdgeArray    :
  0 : (EndVertextIndex :   1, WeightVal :    13), [ (0,1,13) ]
  1 : (EndVertextIndex :   2, WeightVal :     8), [ (0,2,8) ]
  2 : (EndVertextIndex :   3, WeightVal :    13), [ (2,3,5) ]
  3 : (EndVertextIndex :   4, WeightVal :    19), [ (3,4,6) ]
  4 : (EndVertextIndex :   5, WeightVal :    21), [ (4,5,2) ]
  5 : (EndVertextIndex :   6, WeightVal :    20), [ (1,6,7) ]
PathLenArray       : [ (0,2,8),(0,1,13),(0,3,13),(0,4,19),(0,6,20),(0,5,21) ]
PathLenArrayLen    : 6
PathLenArrayMaxLen : 6

这样我们就得到0到其他节点的权值啦,有什么写的不妥的,大家可以多提建议。

Dijkstra的时间算法复杂度为:O(n^2)。

四、宏定义

宏定义和部分定义结构体用的是之前的图的,可以参考之前的博客《数据结构与算法基础-学习-23-图之邻接矩阵与邻接表》。

五、自定义结构体

1、StAccessPath

typedef struct StAccessPath
{
    NetArcDataType*  AccessArray;       //存储从起始节点到目的节点的各个节点的信息。
    VertexIndexType  AccessArrayLen;    //AccessArray数组长度。
    VertexIndexType  AccessArrayMaxLen; //AccessArray数组最大长度,顶点数减一。
}StAccessPath;

2、StBaseDijkstra

typedef struct StBaseDijkstra
{
    WeightType       WeightVal;         //从起始节点到目的节点的权值。
    VertexIndexType  EndVertextIndex;   //结束顶点的索引号。
    StAccessPath*    AccessPath;
} StBaseDijkstra;

3、StDijkstra

typedef struct StDijkstra
{
    StBaseDijkstra* LowestEdgeArray;    //用于存储最短边变化过程的数组。
    NetArcDataType* PathLenArray;       //记录起始顶点到各个顶点的信息。  
    VertexIndexType PathLenArrayLen;    //记录PathLenArray的使用长度。
    VertexIndexType PathLenArrayMaxLen; //记录PathLenArray的最大使用长度。
} StDijkstra;

4、StDijkstraAccees

typedef struct StDijkstraAccees
{
    StAccessPath**   AccessPath;
    VertexIndexType  AccessPathMaxLen; //AccessPath数组最大长度,也可以说是最大行数,顶点数减一。 
}StDijkstraAccees;

六、函数定义

1、InitStAccessPath

Status InitStAccessPath(StAccessPath** StAP, VertexIndexType ArrayLen)
{
    JudgeAllNullPointer(StAP);

    *StAP                      = (StAccessPath*)MyMalloc(sizeof(StAccessPath));
    (*StAP)->AccessArray       = (NetArcDataType*)MyMalloc(sizeof(NetArcDataType) * ArrayLen);
    (*StAP)->AccessArrayLen    = 0;
    (*StAP)->AccessArrayMaxLen = ArrayLen;

    LogFormat(Debug, "%s\n", "Init StAccessPath OK.");
    return SuccessFlag;
}

初始化访问路径结构体。

2、DestroyStAccessPath

Status DestroyStAccessPath(StAccessPath** StAP)
{
    JudgeAllNullPointer(StAP);

    free((*StAP)->AccessArray);
    (*StAP)->AccessArray       = NULL;
    (*StAP)->AccessArrayLen    = 0;
    (*StAP)->AccessArrayMaxLen = 0;
    free(*StAP);
    *StAP                      = NULL;

    LogFormat(Debug, "%s\n", "Destroy StAccessPath OK.");
    return SuccessFlag;
}

销毁访问路径结构体。

3、InitStDijkstra

Status InitStDijkstra(StDijkstra** StDks, VertexIndexType VertexNum, VertexIndexType StartVertexIndex)
{
    JudgeAllNullPointer(StDks);

    VertexIndexType i          = 0;
    VertexIndexType j          = 0;
    *StDks                     = (StDijkstra*)MyMalloc(sizeof(StDijkstra));

    (*StDks)->LowestEdgeArray  = (StBaseDijkstra*)MyMalloc(sizeof(StBaseDijkstra) * (VertexNum - 1));
    for(i = 0,j = 0; i < VertexNum - 1; i++,j++)
    {
        InitStAccessPath(&((*StDks)->LowestEdgeArray[i].AccessPath), VertexNum - 1);
        if (j == StartVertexIndex)
        {
            j++;
        }
        (*StDks)->LowestEdgeArray[i].EndVertextIndex = j;
        (*StDks)->LowestEdgeArray[i].WeightVal       = 0;
    }

    (*StDks)->PathLenArray       = (NetArcDataType*)MyMalloc(sizeof(NetArcDataType) * (VertexNum - 1));
    (*StDks)->PathLenArrayLen    = 0;
    (*StDks)->PathLenArrayMaxLen = VertexNum - 1;

    LogFormat(Debug, "%s\n", "Init StDijkstra OK.");
    return SuccessFlag;
}

初始化结构体。

4、DestroyStDijkstra

Status DestroyStDijkstra(StDijkstra** StDks)
{
    JudgeAllNullPointer(StDks);

    VertexIndexType i = 0;
    for(i = 0; i < (*StDks)->PathLenArrayMaxLen; i++)
    {
        DestroyStAccessPath(&((*StDks)->LowestEdgeArray[i].AccessPath));
        (*StDks)->LowestEdgeArray[i].EndVertextIndex = 0;
        (*StDks)->LowestEdgeArray[i].WeightVal       = 0;
    }

    free((*StDks)->PathLenArray);
    (*StDks)->PathLenArray = NULL;
    (*StDks)->PathLenArrayLen    = 0;
    (*StDks)->PathLenArrayMaxLen = 0;

    free(*StDks);
    *StDks                       = NULL;

    LogFormat(Debug, "%s\n", "Destroy StDijkstra OK.");
    return SuccessFlag;
}

销毁结构体。

5、InitStDijkstraAccees

Status InitStDijkstraAccees(StDijkstraAccees** StDA, VertexIndexType VertexNum)
{
    JudgeAllNullPointer(StDA);

    VertexIndexType i         = 0;

    *StDA                     = (StDijkstraAccees*)MyMalloc(sizeof(StDijkstraAccees));

    (*StDA)->AccessPath       = (StAccessPath**)MyMalloc(sizeof(StAccessPath*) * (VertexNum - 1));
    for (i = 0; i < VertexNum - 1; i++)
    {
        InitStAccessPath(&((*StDA)->AccessPath[i]), VertexNum - 1);
    }
    
    (*StDA)->AccessPathMaxLen = VertexNum - 1;

    LogFormat(Debug, "%s\n", "Init StDijkstraAccees OK.");
    return SuccessFlag;
}

6、DestroyStDijkstraAccees

Status DestroyStDijkstraAccees(StDijkstraAccees** StDA)
{
    JudgeAllNullPointer(StDA);

    VertexIndexType i         = 0;

    for (i = 0; i < (*StDA)->AccessPathMaxLen; i++)
    {
        DestroyStAccessPath(&((*StDA)->AccessPath[i]));
    }
    free((*StDA)->AccessPath);
    (*StDA)->AccessPath       = NULL;

    (*StDA)->AccessPathMaxLen = 0;

    free(*StDA);
    *StDA                     = NULL;
    
    LogFormat(Debug, "%s\n", "Destroy StDijkstraAccees OK.");
    return SuccessFlag;
}

7、JudgeVertexIsAccessed

//判断这个点是否被访问过
//SuccessFlag 表示被访问。FailFlag 表示没有被访问。
Status JudgeVertexIsAccessed(StDijkstra* StDks, VertexIndexType VertexIndex)
{
    JudgeAllNullPointer(StDks);
    VertexIndexType i = 0;

    for (i = 0; i < StDks->PathLenArrayLen; i++)
    {
        if (VertexIndex == StDks->PathLenArray[i].EndVertexIndex)
        {
            LogFormat(Debug,"Judge Vertex(%d) Is Accessed.\n",VertexIndex);
            return SuccessFlag;
        }
    }

    LogFormat(Debug,"Judge Vertex(%d) Is Not Accessed.\n",VertexIndex);
    return FailFlag;
}

8、PushData2StAccessPath

//将访问路径压入到结构体StAccessPath中。
Status PushData2StAccessPath(StAccessPath* StAP, NetArcDataType Data)
{
    JudgeAllNullPointer(StAP);

   LogFormat(Debug,"(StartVertexIndex : %d, EndVertexIndex : %d, Weight : %d)\n",Data.StartVertexIndex,Data.EndVertexIndex,Data.Weight);

    if (StAP->AccessArrayLen == StAP->AccessArrayMaxLen)
    {
        LogFormat(Error, "%s\n", "StAccessPath Is Full, Exit.");
        exit(ExceptionExitFlag);
    }
    
    StAP->AccessArray[StAP->AccessArrayLen] = Data;//结构体复制。
    (StAP->AccessArrayLen)++;

    LogFormat(Debug, "%s\n", "Push Data To StAccessPath OK.");
    return SuccessFlag;    
}

9、ClearData2StAccessPath

//将结构体StAccessPath的数据清零。
//没有使用到此函数。
Status ClearData2StAccessPath(StAccessPath* StAP)
{
    JudgeAllNullPointer(StAP);
    
    StAP->AccessArrayLen = 0;

    LogFormat(Debug, "%s\n", "Clear Data To StAccessPath OK.");
    return SuccessFlag;    
}

10、PushData2PathLenArray

//将起始节点到结束节点的权值和索引号压入到PathLenArray中。
Status PushData2PathLenArray(StDijkstra* StDks, NetArcDataType Data)
{
    JudgeAllNullPointer(StDks);

    if (StDks->PathLenArrayLen == StDks->PathLenArrayMaxLen)
    {
        LogFormat(Error, "%s\n", "PathLenArray Is Full, Exit.");
        exit(ExceptionExitFlag);
    }
    
    StDks->PathLenArray[StDks->PathLenArrayLen] = Data;//结构体复制。
    (StDks->PathLenArrayLen)++;

    PrintfStDijkstra(StDks, Debug);

    LogFormat(Debug, "%s\n", "Push Data To StAccessPath OK.");
    return SuccessFlag;    
}

11、PushData2LowestEdgeArray

//将数据压入到LowestEdgeArray中,选出最小的权值及其对应的索引号。
Status PushData2LowestEdgeArray(StDijkstra* StDks, AMGraph* AMG, VertexIndexType PushVertexIndex, VertexIndexType* ReturnVertexIndex, WeightType* ReturnWeightVal)
{
    JudgeAllNullPointer(StDks);
    JudgeAllNullPointer(AMG);
    JudgeAllNullPointer(ReturnVertexIndex);
    JudgeAllNullPointer(ReturnWeightVal);

    VertexIndexType i                   = 0;
    *ReturnWeightVal                    = MAX_INT_TYPE_NUM;//返回找出的最小权值。
    //VertexIndexType ShortestWeightIndex = 0;               //最小权值在最短边数组中的索引号,后续更新到访问路径StDijkstraAccees使用。
    NetArcDataType TmpData;

    if (StDks->PathLenArrayLen == 0)//说明LowestEdgeArray数组中没有数据,需要先加载一次数据,后面才好进行数据对比。
    {
        for (i = 0; i < StDks->PathLenArrayMaxLen; i++)
        {   
            StDks->LowestEdgeArray[i].WeightVal = AMG->ArcArray[PushVertexIndex][StDks->LowestEdgeArray[i].EndVertextIndex];

            //将访问路径信息写入到结构体StAccessPath中。
            if (StDks->LowestEdgeArray[i].WeightVal != MAX_INT_TYPE_NUM)
            {
                TmpData.StartVertexIndex = PushVertexIndex;
                TmpData.EndVertexIndex   = StDks->LowestEdgeArray[i].EndVertextIndex;
                TmpData.Weight           = StDks->LowestEdgeArray[i].WeightVal;
                PushData2StAccessPath(StDks->LowestEdgeArray[i].AccessPath,TmpData);
            }
            
            if (*ReturnWeightVal > StDks->LowestEdgeArray[i].WeightVal)//找权值最小的索引号。
            {
                *ReturnWeightVal    = StDks->LowestEdgeArray[i].WeightVal;
                *ReturnVertexIndex  = StDks->LowestEdgeArray[i].EndVertextIndex;
                //ShortestWeightIndex = i;
            }
        }
    }
    else//说明LowestEdgeArray数组已经有了数据,我们需要对比之前的数据,比原值小的进行更新,不然跳过。
    {
        for (i = 0; i < StDks->PathLenArrayMaxLen; i++)
        {
            if (JudgeVertexIsAccessed(StDks, StDks->LowestEdgeArray[i].EndVertextIndex) == SuccessFlag)//访问过的点不需要更新权值
            {
                continue;
            }

            //如果邻接矩阵中的权值+上一个最短边数组中的权值<最短边数组中的权值,进行数据更新。
            if (StDks->LowestEdgeArray[i].WeightVal > AMG->ArcArray[PushVertexIndex][StDks->LowestEdgeArray[i].EndVertextIndex] + StDks->PathLenArray[StDks->PathLenArrayLen - 1].Weight)
            {
                StDks->LowestEdgeArray[i].WeightVal = AMG->ArcArray[PushVertexIndex][StDks->LowestEdgeArray[i].EndVertextIndex] + StDks->PathLenArray[StDks->PathLenArrayLen - 1].Weight;

                //将访问路径信息写入到结构体StAccessPath中。
                //下面这段逻辑需要改进,理想中是可以直接查出起始节点到个节点的路径信息。
                //暂时没有想到其他好的方法。
                //现在是申请了顶点个数相当的数组个数,其实只用了数组中的第一个空间,这个先不改了,想为了上面的改进做准备。
                if (StDks->LowestEdgeArray[i].WeightVal != MAX_INT_TYPE_NUM)
                {
                    TmpData.StartVertexIndex = PushVertexIndex;
                    TmpData.EndVertexIndex   = StDks->LowestEdgeArray[i].EndVertextIndex;
                    TmpData.Weight           = AMG->ArcArray[PushVertexIndex][StDks->LowestEdgeArray[i].EndVertextIndex];
                    ClearData2StAccessPath(StDks->LowestEdgeArray[i].AccessPath);
                    PushData2StAccessPath(StDks->LowestEdgeArray[i].AccessPath,TmpData);
                }
            }

            if (*ReturnWeightVal > StDks->LowestEdgeArray[i].WeightVal)//找权值最小的索引号。
            {
                *ReturnWeightVal    = StDks->LowestEdgeArray[i].WeightVal;
                *ReturnVertexIndex  = StDks->LowestEdgeArray[i].EndVertextIndex;
                //ShortestWeightIndex = i;
            }
        }
    }

    LogFormat(Debug, "%s\n", "Push Data To Lowest Edge Array OK.");
    return SuccessFlag;
}

将数据压入最短边数组中。

12、PushData2StDijkstraAccees

Status PushData2StDijkstraAccees(StDijkstraAccees* StDA, VertexIndexType InsertNodeIndex, VertexIndexType StartIndex, VertexIndexType EndIndex, WeightType Weight)
{
    JudgeAllNullPointer(StDA);

    if (InsertNodeIndex >= StDA->AccessPathMaxLen)
    {
        LogFormat(Error, "Parameter InsertNodeIndex(%d) Need < AccessPathMaxLen(%d), Exit.\n", InsertNodeIndex, StDA->AccessPathMaxLen);
        exit(ExceptionExitFlag);
    }

    if (StDA->AccessPath[InsertNodeIndex]->AccessArrayLen == StDA->AccessPath[InsertNodeIndex]->AccessArrayMaxLen)
    {
        LogFormat(Error, "AccessPath[%d] Is Full, AccessArrayMaxLen : %d, Exit.\n", InsertNodeIndex, StDA->AccessPath[InsertNodeIndex]->AccessArrayMaxLen);
        exit(ExceptionExitFlag);
    }
    
    StDA->AccessPath[InsertNodeIndex]->AccessArray[StDA->AccessPath[InsertNodeIndex]->AccessArrayLen].StartVertexIndex = StartIndex;
    StDA->AccessPath[InsertNodeIndex]->AccessArray[StDA->AccessPath[InsertNodeIndex]->AccessArrayLen].EndVertexIndex   = EndIndex;
    StDA->AccessPath[InsertNodeIndex]->AccessArray[StDA->AccessPath[InsertNodeIndex]->AccessArrayLen].Weight           = Weight;

    StDA->AccessPath[InsertNodeIndex]->AccessArrayLen++;

    LogFormat(Debug, "%s\n", "Push Data To StDijkstraAccees OK.");
    return SuccessFlag;    
}

13、StatisticsStDijkstraAccees

//统计起始节点到各个节点的访问路径。
Status StatisticsStDijkstraAccees(StDijkstra* StDks, StDijkstraAccees* StDA, VertexIndexType StartVertexIndex)
{
    JudgeAllNullPointer(StDks);
    JudgeAllNullPointer(StDA);   

    VertexIndexType  i            = 0;
    VertexIndexType  j            = 0;
    VertexIndexType  x            = 0;
    VertexIndexType  TmpIndex     = 0;//临时变量,存放顶点索引信息。
    VertexIndexType* VisitedArray = (VertexIndexType*)MyMalloc(StDks->PathLenArrayLen * sizeof(VertexIndexType));//存放已经命中的索引。

    for (i = 0; i < StDks->PathLenArrayMaxLen; i++)
    {
        //LogFormat(Debug,"i : %d, StartVertexIndex : %d\n",i,StartVertexIndex);

        if (StDks->LowestEdgeArray[i].AccessPath->AccessArrayLen == 0)//访问节点数组长度为0时,跳过。
        {
            continue;
        }
        
        //LogFormat(Debug,"(%d,%d,%d,%d,%d,%d)\n",VisitedArray[0],VisitedArray[1],VisitedArray[2],VisitedArray[3],VisitedArray[4],VisitedArray[5]);
        //取最外层的顶点信息,如果起始节点等于传入的起始节点索引,不需要寻找其祖先顶点。
        if (StDks->LowestEdgeArray[i].AccessPath->AccessArray[StDks->LowestEdgeArray[i].AccessPath->AccessArrayLen - 1].StartVertexIndex == StartVertexIndex)
        {
            LogFormat(Debug, "No Need To Traverse, Find OK, i : %d, StartVertexIndex : %d\n",i,StartVertexIndex);
            PushData2StDijkstraAccees(StDA, 
                                      i, 
                                      StartVertexIndex, 
                                      StDks->LowestEdgeArray[i].AccessPath->AccessArray[StDks->LowestEdgeArray[i].AccessPath->AccessArrayLen - 1].EndVertexIndex, 
                                      StDks->LowestEdgeArray[i].AccessPath->AccessArray[StDks->LowestEdgeArray[i].AccessPath->AccessArrayLen - 1].Weight);
            continue;
        }

        for ( x = 0; x < StDks->PathLenArrayMaxLen; x++)//初始化VisitedArray数据
        {
            if (StDks->LowestEdgeArray[i].AccessPath->AccessArrayLen == 0)
            {
                VisitedArray[x] = VISITED_FLAG;
            }
            else
            {
                VisitedArray[x] = NOT_VISITED_FLAG;
            }
        }
        
        PushData2StDijkstraAccees(StDA, 
                            i, 
                            StDks->LowestEdgeArray[i].AccessPath->AccessArray[StDks->LowestEdgeArray[i].AccessPath->AccessArrayLen - 1].StartVertexIndex, 
                            StDks->LowestEdgeArray[i].AccessPath->AccessArray[StDks->LowestEdgeArray[i].AccessPath->AccessArrayLen - 1].EndVertexIndex, 
                            StDks->LowestEdgeArray[i].AccessPath->AccessArray[StDks->LowestEdgeArray[i].AccessPath->AccessArrayLen - 1].Weight);
        VisitedArray[i] = VISITED_FLAG;
        TmpIndex        = StDks->LowestEdgeArray[i].AccessPath->AccessArray[StDks->LowestEdgeArray[i].AccessPath->AccessArrayLen - 1].StartVertexIndex;
        j               = 0;

        while (TmpIndex != StartVertexIndex)
        {
            if (VisitedArray[j] == VISITED_FLAG)//如果这个节点被访问了,就不需要进行访问了
            {
                continue;
            }
            //LogFormat(Debug,"(%d,%d,%d,%d,%d,%d)\n",VisitedArray[0],VisitedArray[1],VisitedArray[2],VisitedArray[3],VisitedArray[4],VisitedArray[5]);
            //LogFormat(Debug,"j : %d, TmpIndex : %d, CmpIndex : %d,StartVertexIndex : %d\n",j,TmpIndex,StDks->LowestEdgeArray[j].AccessPath->AccessArray[StDks->LowestEdgeArray[j].AccessPath->AccessArrayLen - 1].EndVertexIndex,StartVertexIndex);
            if (TmpIndex == StDks->LowestEdgeArray[j].AccessPath->AccessArray[StDks->LowestEdgeArray[j].AccessPath->AccessArrayLen - 1].EndVertexIndex)
            {
                PushData2StDijkstraAccees(StDA, 
                                          i, 
                                          StDks->LowestEdgeArray[j].AccessPath->AccessArray[StDks->LowestEdgeArray[j].AccessPath->AccessArrayLen - 1].StartVertexIndex,
                                          TmpIndex,
                                          StDks->LowestEdgeArray[j].AccessPath->AccessArray[StDks->LowestEdgeArray[j].AccessPath->AccessArrayLen - 1].Weight);
                TmpIndex = StDks->LowestEdgeArray[j].AccessPath->AccessArray[StDks->LowestEdgeArray[j].AccessPath->AccessArrayLen - 1].StartVertexIndex;
                VisitedArray[j] = VISITED_FLAG;
                j = 0;
                continue;
            }
            j++;
        }
        //memset(VisitedArray, NOT_VISITED_FLAG, StDks->PathLenArrayLen * sizeof(VertexIndexType));
    }
    
    free(VisitedArray);
    VisitedArray = NULL;

    LogFormat(Debug, "%s\n", "Statistics StDijkstraAccees OK.");

    return SuccessFlag; 
}

14、DijkstraAlgorithm

Status DijkstraAlgorithm(AMGraph* AMG, StDijkstraAccees* StDA, VertexIndexType StartVertexIndex)
{
    JudgeAllNullPointer(AMG);
    JudgeAllNullPointer(StDA);

    if (AMG->DirectionFlag != NET_DIRECTION_FLAG)
    {
        LogFormat(Warning, "Dijkstra Algorithm Need Directed Net.\n");
        return FailFlag;
    }
    
    StDijkstra*     StDks              = NULL;
    VertexIndexType ReturnVertexIndex  = 0;
    WeightType      ReturnWeightVal    = 0;
    VertexIndexType TmpVertexIndex     = 0;
    NetArcDataType  TmpData;

    InitStDijkstra(&StDks, AMG->CurVertexNum, StartVertexIndex);
    PushData2LowestEdgeArray(StDks, AMG, StartVertexIndex, &ReturnVertexIndex, &ReturnWeightVal);
    TmpData.StartVertexIndex = StartVertexIndex;
    TmpData.EndVertexIndex   = ReturnVertexIndex;
    TmpData.Weight           = ReturnWeightVal;
    TmpVertexIndex           = ReturnVertexIndex;
    PushData2PathLenArray(StDks, TmpData);

    while(StDks->PathLenArrayLen != StDks->PathLenArrayMaxLen)
    {
        PushData2LowestEdgeArray(StDks, AMG, TmpVertexIndex, &ReturnVertexIndex, &ReturnWeightVal);
        
        if (ReturnWeightVal == MAX_INT_TYPE_NUM)//如果返回无穷大权值,说明已经找到所有可访问路径。
        {
            LogFormat(Debug, "ReturnWeightVal : %d, Find All Access Path Ahead Of Time.\n",MAX_INT_TYPE_NUM);
            break;
        }
        
        TmpData.StartVertexIndex = StartVertexIndex;
        TmpData.EndVertexIndex   = ReturnVertexIndex;
        TmpData.Weight           = ReturnWeightVal;
        TmpVertexIndex           = ReturnVertexIndex;
        PushData2PathLenArray(StDks, TmpData);
    }

    StatisticsStDijkstraAccees(StDks, StDA, StartVertexIndex);

    DestroyStDijkstra(&StDks);

    LogFormat(Debug, "%s\n", "Dijkstra Algorithm OK.");
    return SuccessFlag;
}

15、PrintfStDijkstra

Status PrintfStDijkstra(StDijkstra* StDks, int PrintLevel)
{
    JudgeAllNullPointer(StDks);

    VertexIndexType i      = 0;
    VertexIndexType j      = 0;
    char*           string = (char*)MyCalloc(STR_TYPE_SIZE, sizeof(char));
    CopyStr*        PS     = NULL;

    InitCopyStr(&PS);
    ExecCopyStr(PS,"Printf StDijkstra\n");
    ExecCopyStr(PS,"LowestEdgeArray    :\n");

    for (i = 0; i < StDks->PathLenArrayMaxLen; i++)
    {
        sprintf(string,"%3d : (EndVertextIndex : %3d, WeightVal : %5d), [ ",i,
                                                                        StDks->LowestEdgeArray[i].EndVertextIndex,
                                                                        StDks->LowestEdgeArray[i].WeightVal);
        ExecCopyStr(PS,string);
        for (j = 0; j < StDks->LowestEdgeArray[i].AccessPath->AccessArrayLen; j++)
        {
            sprintf(string,"(%d,%d,%d),", StDks->LowestEdgeArray[i].AccessPath->AccessArray[j].StartVertexIndex,
                                          StDks->LowestEdgeArray[i].AccessPath->AccessArray[j].EndVertexIndex,
                                          StDks->LowestEdgeArray[i].AccessPath->AccessArray[j].Weight);
            ExecCopyStr(PS,string);
        }
        PS->String[PS->StrEffectiveLen-1] = ' ';
        ExecCopyStr(PS,"]\n");
    }

    ExecCopyStr(PS,"PathLenArray       : [ ");
    for (i = 0; i < StDks->PathLenArrayLen; i++)
    {
        sprintf(string,"(%d,%d,%d),",StDks->PathLenArray[i].StartVertexIndex,
                                     StDks->PathLenArray[i].EndVertexIndex,
                                     StDks->PathLenArray[i].Weight);
        ExecCopyStr(PS,string);
    }
    PS->String[PS->StrEffectiveLen-1] = ' ';
    ExecCopyStr(PS,"]\n");

    sprintf(string,"PathLenArrayLen    : %d\n",StDks->PathLenArrayLen);
    ExecCopyStr(PS,string);

    sprintf(string,"PathLenArrayMaxLen : %d\n",StDks->PathLenArrayMaxLen);
    ExecCopyStr(PS,string);
    
    Log(PS->String, PrintLevel);
    DestroyCopyStr(&PS);
    free(string);
    string = NULL;

    return SuccessFlag;
}

16、PrintfStDijkstraAccees

Status PrintfStDijkstraAccees(StDijkstraAccees* StDA, int PrintLevel)
{
    JudgeAllNullPointer(StDA);

    VertexIndexType i      = 0;
    VertexIndexType j      = 0;
    char*           string = (char*)MyCalloc(STR_TYPE_SIZE, sizeof(char));
    CopyStr*        PS     = NULL;

    InitCopyStr(&PS);
    ExecCopyStr(PS,"Printf StDijkstra\n");
    ExecCopyStr(PS,"AccessPath         :\n");

    for (i = 0; i < StDA->AccessPathMaxLen; i++)
    {
        ExecCopyStr(PS,"[ ");
        for (j = 0; j < StDA->AccessPath[i]->AccessArrayLen; j++)
        {
            sprintf(string,"(%d,%d,%d),",StDA->AccessPath[i]->AccessArray[j].StartVertexIndex,
                                         StDA->AccessPath[i]->AccessArray[j].EndVertexIndex,
                                         StDA->AccessPath[i]->AccessArray[j].Weight);
            ExecCopyStr(PS,string);
        }
        PS->String[PS->StrEffectiveLen-1] = ' ';
        ExecCopyStr(PS,"]\n");
    }

    sprintf(string,"AccessPathMaxLen : %d\n",StDA->AccessPathMaxLen);
    ExecCopyStr(PS,string);
    
    Log(PS->String, PrintLevel);
    DestroyCopyStr(&PS);
    free(string);
    string = NULL;

    return SuccessFlag;
}

七、Linux环境编译测试

1、起点为0

[root@czg2 Graph]# ./TestGraph 
[2023-7]--[ Debug ]--Create Net Data                    : OK
[2023-7]--[ Debug ]--Create Net Use AMGraph             : OK
[2023-7]--[ Debug ]--Printf AMGraph                     :
VertexArray    : [0 ,1 ,2 ,3 ,4 ,5 ,6 ]
ArcArray       :
[32767 ,13    ,8     ,32767 ,30    ,32767 ,32    ]
[32767 ,32767 ,32767 ,32767 ,32767 ,9     ,7     ]
[32767 ,32767 ,32767 ,5     ,32767 ,32767 ,32767 ]
[32767 ,32767 ,32767 ,32767 ,6     ,32767 ,32767 ]
[32767 ,32767 ,32767 ,32767 ,32767 ,2     ,32767 ]
[32767 ,32767 ,32767 ,32767 ,32767 ,32767 ,17    ]
[32767 ,32767 ,32767 ,32767 ,32767 ,32767 ,32767 ]
CurVertexNum   : 7
CurArcNum      : 10
[2023-7]--[ Debug ]--Create Net Use AGraph              : OK
[2023-7]--[ Debug ]--Printf AGraph                      :
0 : [ (6, 32, 0x18e68d0),(4, 30, 0x18e68b0),(2, 8, 0x18e6890),(1, 13, (nil))]
1 : [ (6, 7, 0x18e6910),(5, 9, (nil))]
2 : [ (3, 5, (nil))]
3 : [ (4, 6, (nil))]
4 : [ (5, 2, (nil))]
5 : [ (6, 17, (nil))]
6 : []
VertexNum      : 7
ArcNum         : 10
[2023-7]--[ Debug ]--Traverse Use AMGraph               : [6 ]
[2023-7]--[ Debug ]--Traverse Use AGraph                : [6 ]
[2023-7]--[ Debug ]--Init SqQueue Normal
[2023-7]--[ Debug ]--Enter SqQueue Normal
[2023-7]--[ Debug ]--Leave SqQueue Normal
[2023-7]--[ Debug ]--Destroy SqQueue Normal
[2023-7]--[ Debug ]--Breadth First Search Use AMGraph OK
[2023-7]--[ Debug ]--Traverse Use AMGraph               : [6 ]
[2023-7]--[ Debug ]--Init SqQueue Normal
[2023-7]--[ Debug ]--Enter SqQueue Normal
[2023-7]--[ Debug ]--Leave SqQueue Normal
[2023-7]--[ Debug ]--Destroy SqQueue Normal
[2023-7]--[ Debug ]--Breadth First Search Use AGraph OK
[2023-7]--[ Debug ]--Traverse Use AGraph                : [6 ]
[2023-7]--[ Debug ]--Init WeightSortList OK
[2023-7]--[ Debug ]--Kluskal WeightSort OK
[2023-7]--[ Debug ]--Printf WeightSortList
Data : [(4, 5, 2, 0x18e6cb0),(2, 3, 5, 0x18e6cd0),(3, 4, 6, 0x18e6c70),(1, 6, 7, 0x18e6c30),(0, 2, 8, 0x18e6c90),(1, 5, 9, 0x18e6c50),(0, 1, 13, 0x18e6d10),(5, 6, 17, 0x18e6c10),(0, 4, 30, 0x18e6bf0),(0, 6, 32, 0x18e6cf0)]
NodeCnt : 10
[2023-7]--[ Debug ]--Printf Parent Array
{ -1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 }
[2023-7]--[ Debug ]--Printf Parent Array
{ -1 ,-1 ,-1 ,-1 ,-1 ,4 ,-1 }
[2023-7]--[ Debug ]--Printf Parent Array
{ -1 ,-1 ,-1 ,2 ,-1 ,4 ,-1 }
[2023-7]--[ Debug ]--Printf Parent Array
{ -1 ,-1 ,-1 ,2 ,2 ,4 ,-1 }
[2023-7]--[ Debug ]--Printf Parent Array
{ -1 ,-1 ,-1 ,2 ,2 ,4 ,1 }
[2023-7]--[ Debug ]--Printf Parent Array
{ -1 ,-1 ,0 ,2 ,2 ,4 ,1 }
[2023-7]--[ Debug ]--Destroy WeightSortList OK
[2023-7]--[ Info  ]--Kluskal Create MST OK
[2023-7]--[ Debug ]--Printf MST
{ (4,5,2),(2,3,5),(3,4,6),(1,6,7),(0,2,8),(1,5,9)}
[2023-7]--[ Debug ]--Printf ShortestEdgeArray
{(0,0),(0,13),(0,8),(0,32767),(0,30),(0,32767),(0,32)}
ArrayLen    : 1
ArrayMaxLen : 7
[2023-7]--[ Debug ]--Init ShortestEdgeArray OK
LowestEdgeVertexIndex : 2
[2023-7]--[ Debug ]--Printf ShortestEdgeArray
{(0,0),(0,13),(0,0),(2,5),(0,30),(0,32767),(0,32)}
ArrayLen    : 2
ArrayMaxLen : 7
LowestEdgeVertexIndex : 3
[2023-7]--[ Debug ]--Printf ShortestEdgeArray
{(0,0),(0,13),(0,0),(2,0),(3,6),(0,32767),(0,32)}
ArrayLen    : 3
ArrayMaxLen : 7
LowestEdgeVertexIndex : 4
[2023-7]--[ Debug ]--Printf ShortestEdgeArray
{(0,0),(0,13),(0,0),(2,0),(3,0),(4,2),(0,32)}
ArrayLen    : 4
ArrayMaxLen : 7
LowestEdgeVertexIndex : 5
[2023-7]--[ Debug ]--Printf ShortestEdgeArray
{(0,0),(0,13),(0,0),(2,0),(3,0),(4,0),(5,17)}
ArrayLen    : 5
ArrayMaxLen : 7
LowestEdgeVertexIndex : 1
[2023-7]--[ Debug ]--Printf ShortestEdgeArray
{(0,0),(0,0),(0,0),(2,0),(3,0),(4,0),(1,7)}
ArrayLen    : 6
ArrayMaxLen : 7
LowestEdgeVertexIndex : 6
[2023-7]--[ Debug ]--Destroy ShortestEdgeArray OK
[2023-7]--[ Info  ]--Prim Create MST OK
[2023-7]--[ Debug ]--Printf MST
{ (0,2,8),(2,3,5),(3,4,6),(4,5,2),(0,1,13),(1,6,7)}
[2023-7]--[ Debug ]--Init StAccessPath OK.
[2023-7]--[ Debug ]--Init StAccessPath OK.
[2023-7]--[ Debug ]--Init StAccessPath OK.
[2023-7]--[ Debug ]--Init StAccessPath OK.
[2023-7]--[ Debug ]--Init StAccessPath OK.
[2023-7]--[ Debug ]--Init StAccessPath OK.
[2023-7]--[ Debug ]--Init StDijkstraAccees OK.
[2023-7]--[ Debug ]--Init StAccessPath OK.
[2023-7]--[ Debug ]--Init StAccessPath OK.
[2023-7]--[ Debug ]--Init StAccessPath OK.
[2023-7]--[ Debug ]--Init StAccessPath OK.
[2023-7]--[ Debug ]--Init StAccessPath OK.
[2023-7]--[ Debug ]--Init StAccessPath OK.
[2023-7]--[ Debug ]--Init StDijkstra OK.
[2023-7]--[ Debug ]--(StartVertexIndex : 1, EndVertexIndex : 5, Weight : 9)
[2023-7]--[ Debug ]--Push Data To StAccessPath OK.
[2023-7]--[ Debug ]--(StartVertexIndex : 1, EndVertexIndex : 6, Weight : 7)
[2023-7]--[ Debug ]--Push Data To StAccessPath OK.
[2023-7]--[ Debug ]--Push Data To Lowest Edge Array OK.
[2023-7]--[ Debug ]--Printf StDijkstra
LowestEdgeArray    :
  0 : (EndVertextIndex :   0, WeightVal : 32767), [ ]
  1 : (EndVertextIndex :   2, WeightVal : 32767), [ ]
  2 : (EndVertextIndex :   3, WeightVal : 32767), [ ]
  3 : (EndVertextIndex :   4, WeightVal : 32767), [ ]
  4 : (EndVertextIndex :   5, WeightVal :     9), [ (1,5,9) ]
  5 : (EndVertextIndex :   6, WeightVal :     7), [ (1,6,7) ]
PathLenArray       : [ (1,6,7) ]
PathLenArrayLen    : 1
PathLenArrayMaxLen : 6
[2023-7]--[ Debug ]--Push Data To StAccessPath OK.
[2023-7]--[ Debug ]--Judge Vertex(0) Is Not Accessed.
[2023-7]--[ Debug ]--Judge Vertex(2) Is Not Accessed.
[2023-7]--[ Debug ]--Judge Vertex(3) Is Not Accessed.
[2023-7]--[ Debug ]--Judge Vertex(4) Is Not Accessed.
[2023-7]--[ Debug ]--Judge Vertex(5) Is Not Accessed.
[2023-7]--[ Debug ]--Judge Vertex(6) Is Accessed.
[2023-7]--[ Debug ]--Push Data To Lowest Edge Array OK.
[2023-7]--[ Debug ]--Printf StDijkstra
LowestEdgeArray    :
  0 : (EndVertextIndex :   0, WeightVal : 32767), [ ]
  1 : (EndVertextIndex :   2, WeightVal : 32767), [ ]
  2 : (EndVertextIndex :   3, WeightVal : 32767), [ ]
  3 : (EndVertextIndex :   4, WeightVal : 32767), [ ]
  4 : (EndVertextIndex :   5, WeightVal :     9), [ (1,5,9) ]
  5 : (EndVertextIndex :   6, WeightVal :     7), [ (1,6,7) ]
PathLenArray       : [ (1,6,7),(1,5,9) ]
PathLenArrayLen    : 2
PathLenArrayMaxLen : 6
[2023-7]--[ Debug ]--Push Data To StAccessPath OK.
[2023-7]--[ Debug ]--Judge Vertex(0) Is Not Accessed.
[2023-7]--[ Debug ]--Judge Vertex(2) Is Not Accessed.
[2023-7]--[ Debug ]--Judge Vertex(3) Is Not Accessed.
[2023-7]--[ Debug ]--Judge Vertex(4) Is Not Accessed.
[2023-7]--[ Debug ]--Judge Vertex(5) Is Accessed.
[2023-7]--[ Debug ]--Judge Vertex(6) Is Accessed.
[2023-7]--[ Debug ]--Push Data To Lowest Edge Array OK.
[2023-7]--[ Debug ]--ReturnWeightVal : 32767, Find All Access Path Ahead Of Time.
[2023-7]--[ Debug ]--No Need To Traverse, Find OK, i : 4, StartVertexIndex : 1
[2023-7]--[ Debug ]--Push Data To StDijkstraAccees OK.
[2023-7]--[ Debug ]--No Need To Traverse, Find OK, i : 5, StartVertexIndex : 1
[2023-7]--[ Debug ]--Push Data To StDijkstraAccees OK.
[2023-7]--[ Debug ]--Statistics StDijkstraAccees OK.
[2023-7]--[ Debug ]--Destroy StAccessPath OK.
[2023-7]--[ Debug ]--Destroy StAccessPath OK.
[2023-7]--[ Debug ]--Destroy StAccessPath OK.
[2023-7]--[ Debug ]--Destroy StAccessPath OK.
[2023-7]--[ Debug ]--Destroy StAccessPath OK.
[2023-7]--[ Debug ]--Destroy StAccessPath OK.
[2023-7]--[ Debug ]--Destroy StDijkstra OK.
[2023-7]--[ Debug ]--Dijkstra Algorithm OK.
[2023-7]--[ Debug ]--Printf StDijkstra
AccessPath         :
[ ]
[ ]
[ ]
[ ]
[ (1,5,9) ]
[ (1,6,7) ]
AccessPathMaxLen : 6
[2023-7]--[ Debug ]--Destroy StAccessPath OK.
[2023-7]--[ Debug ]--Destroy StAccessPath OK.
[2023-7]--[ Debug ]--Destroy StAccessPath OK.
[2023-7]--[ Debug ]--Destroy StAccessPath OK.
[2023-7]--[ Debug ]--Destroy StAccessPath OK.
[2023-7]--[ Debug ]--Destroy StAccessPath OK.
[2023-7]--[ Debug ]--Destroy StDijkstraAccees OK.
[2023-7]--[ Debug ]--Destroy Net Data                   : OK
[2023-7]--[ Debug ]--Destroy Net Use AMGraph            : OK
[2023-7]--[ Debug ]--Destroy Net Use AGraph             : OK
[root@czg2 Graph]# vim makefile 
[root@czg2 Graph]# 
[root@czg2 Graph]# 
[root@czg2 Graph]# make
gcc -Wall -Wextra -O3 ../Log/Log.c ../PublicFunction/PublicFunction.c ../PublicFunction/SqQueue/SqQueue.c Graph.c MinimumSpanningTree.c ShortestPath.c main.c -o TestGraph -I ../Log/ -I ../PublicFunction/ -I ../Select/ -I ../PublicFunction/SqQueue/
[root@czg2 Graph]# ./TestGraph 
[2023-7]--[ Debug ]--Create Net Data                    : OK
[2023-7]--[ Debug ]--Create Net Use AMGraph             : OK
[2023-7]--[ Debug ]--Printf AMGraph                     :
VertexArray    : [0 ,1 ,2 ,3 ,4 ,5 ,6 ]
ArcArray       :
[32767 ,13    ,8     ,32767 ,30    ,32767 ,32    ]
[32767 ,32767 ,32767 ,32767 ,32767 ,9     ,7     ]
[32767 ,32767 ,32767 ,5     ,32767 ,32767 ,32767 ]
[32767 ,32767 ,32767 ,32767 ,6     ,32767 ,32767 ]
[32767 ,32767 ,32767 ,32767 ,32767 ,2     ,32767 ]
[32767 ,32767 ,32767 ,32767 ,32767 ,32767 ,17    ]
[32767 ,32767 ,32767 ,32767 ,32767 ,32767 ,32767 ]
CurVertexNum   : 7
CurArcNum      : 10
[2023-7]--[ Debug ]--Create Net Use AGraph              : OK
[2023-7]--[ Debug ]--Printf AGraph                      :
0 : [ (6, 32, 0x1e238d0),(4, 30, 0x1e238b0),(2, 8, 0x1e23890),(1, 13, (nil))]
1 : [ (6, 7, 0x1e23910),(5, 9, (nil))]
2 : [ (3, 5, (nil))]
3 : [ (4, 6, (nil))]
4 : [ (5, 2, (nil))]
5 : [ (6, 17, (nil))]
6 : []
VertexNum      : 7
ArcNum         : 10
[2023-7]--[ Debug ]--Traverse Use AMGraph               : [6 ]
[2023-7]--[ Debug ]--Traverse Use AGraph                : [6 ]
[2023-7]--[ Debug ]--Init SqQueue Normal
[2023-7]--[ Debug ]--Enter SqQueue Normal
[2023-7]--[ Debug ]--Leave SqQueue Normal
[2023-7]--[ Debug ]--Destroy SqQueue Normal
[2023-7]--[ Debug ]--Breadth First Search Use AMGraph OK
[2023-7]--[ Debug ]--Traverse Use AMGraph               : [6 ]
[2023-7]--[ Debug ]--Init SqQueue Normal
[2023-7]--[ Debug ]--Enter SqQueue Normal
[2023-7]--[ Debug ]--Leave SqQueue Normal
[2023-7]--[ Debug ]--Destroy SqQueue Normal
[2023-7]--[ Debug ]--Breadth First Search Use AGraph OK
[2023-7]--[ Debug ]--Traverse Use AGraph                : [6 ]
[2023-7]--[ Debug ]--Init WeightSortList OK
[2023-7]--[ Debug ]--Kluskal WeightSort OK
[2023-7]--[ Debug ]--Printf WeightSortList
Data : [(4, 5, 2, 0x1e23cb0),(2, 3, 5, 0x1e23cd0),(3, 4, 6, 0x1e23c70),(1, 6, 7, 0x1e23c30),(0, 2, 8, 0x1e23c90),(1, 5, 9, 0x1e23c50),(0, 1, 13, 0x1e23d10),(5, 6, 17, 0x1e23c10),(0, 4, 30, 0x1e23bf0),(0, 6, 32, 0x1e23cf0)]
NodeCnt : 10
[2023-7]--[ Debug ]--Printf Parent Array
{ -1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 }
[2023-7]--[ Debug ]--Printf Parent Array
{ -1 ,-1 ,-1 ,-1 ,-1 ,4 ,-1 }
[2023-7]--[ Debug ]--Printf Parent Array
{ -1 ,-1 ,-1 ,2 ,-1 ,4 ,-1 }
[2023-7]--[ Debug ]--Printf Parent Array
{ -1 ,-1 ,-1 ,2 ,2 ,4 ,-1 }
[2023-7]--[ Debug ]--Printf Parent Array
{ -1 ,-1 ,-1 ,2 ,2 ,4 ,1 }
[2023-7]--[ Debug ]--Printf Parent Array
{ -1 ,-1 ,0 ,2 ,2 ,4 ,1 }
[2023-7]--[ Debug ]--Destroy WeightSortList OK
[2023-7]--[ Info  ]--Kluskal Create MST OK
[2023-7]--[ Debug ]--Printf MST
{ (4,5,2),(2,3,5),(3,4,6),(1,6,7),(0,2,8),(1,5,9)}
[2023-7]--[ Debug ]--Printf ShortestEdgeArray
{(0,0),(0,13),(0,8),(0,32767),(0,30),(0,32767),(0,32)}
ArrayLen    : 1
ArrayMaxLen : 7
[2023-7]--[ Debug ]--Init ShortestEdgeArray OK
LowestEdgeVertexIndex : 2
[2023-7]--[ Debug ]--Printf ShortestEdgeArray
{(0,0),(0,13),(0,0),(2,5),(0,30),(0,32767),(0,32)}
ArrayLen    : 2
ArrayMaxLen : 7
LowestEdgeVertexIndex : 3
[2023-7]--[ Debug ]--Printf ShortestEdgeArray
{(0,0),(0,13),(0,0),(2,0),(3,6),(0,32767),(0,32)}
ArrayLen    : 3
ArrayMaxLen : 7
LowestEdgeVertexIndex : 4
[2023-7]--[ Debug ]--Printf ShortestEdgeArray
{(0,0),(0,13),(0,0),(2,0),(3,0),(4,2),(0,32)}
ArrayLen    : 4
ArrayMaxLen : 7
LowestEdgeVertexIndex : 5
[2023-7]--[ Debug ]--Printf ShortestEdgeArray
{(0,0),(0,13),(0,0),(2,0),(3,0),(4,0),(5,17)}
ArrayLen    : 5
ArrayMaxLen : 7
LowestEdgeVertexIndex : 1
[2023-7]--[ Debug ]--Printf ShortestEdgeArray
{(0,0),(0,0),(0,0),(2,0),(3,0),(4,0),(1,7)}
ArrayLen    : 6
ArrayMaxLen : 7
LowestEdgeVertexIndex : 6
[2023-7]--[ Debug ]--Destroy ShortestEdgeArray OK
[2023-7]--[ Info  ]--Prim Create MST OK
[2023-7]--[ Debug ]--Printf MST
{ (0,2,8),(2,3,5),(3,4,6),(4,5,2),(0,1,13),(1,6,7)}
[2023-7]--[ Debug ]--Init StAccessPath OK.
[2023-7]--[ Debug ]--Init StAccessPath OK.
[2023-7]--[ Debug ]--Init StAccessPath OK.
[2023-7]--[ Debug ]--Init StAccessPath OK.
[2023-7]--[ Debug ]--Init StAccessPath OK.
[2023-7]--[ Debug ]--Init StAccessPath OK.
[2023-7]--[ Debug ]--Init StDijkstraAccees OK.
[2023-7]--[ Debug ]--Init StAccessPath OK.
[2023-7]--[ Debug ]--Init StAccessPath OK.
[2023-7]--[ Debug ]--Init StAccessPath OK.
[2023-7]--[ Debug ]--Init StAccessPath OK.
[2023-7]--[ Debug ]--Init StAccessPath OK.
[2023-7]--[ Debug ]--Init StAccessPath OK.
[2023-7]--[ Debug ]--Init StDijkstra OK.
[2023-7]--[ Debug ]--(StartVertexIndex : 0, EndVertexIndex : 1, Weight : 13)
[2023-7]--[ Debug ]--Push Data To StAccessPath OK.
[2023-7]--[ Debug ]--(StartVertexIndex : 0, EndVertexIndex : 2, Weight : 8)
[2023-7]--[ Debug ]--Push Data To StAccessPath OK.
[2023-7]--[ Debug ]--(StartVertexIndex : 0, EndVertexIndex : 4, Weight : 30)
[2023-7]--[ Debug ]--Push Data To StAccessPath OK.
[2023-7]--[ Debug ]--(StartVertexIndex : 0, EndVertexIndex : 6, Weight : 32)
[2023-7]--[ Debug ]--Push Data To StAccessPath OK.
[2023-7]--[ Debug ]--Push Data To Lowest Edge Array OK.
[2023-7]--[ Debug ]--Printf StDijkstra
LowestEdgeArray    :
  0 : (EndVertextIndex :   1, WeightVal :    13), [ (0,1,13) ]
  1 : (EndVertextIndex :   2, WeightVal :     8), [ (0,2,8) ]
  2 : (EndVertextIndex :   3, WeightVal : 32767), [ ]
  3 : (EndVertextIndex :   4, WeightVal :    30), [ (0,4,30) ]
  4 : (EndVertextIndex :   5, WeightVal : 32767), [ ]
  5 : (EndVertextIndex :   6, WeightVal :    32), [ (0,6,32) ]
PathLenArray       : [ (0,2,8) ]
PathLenArrayLen    : 1
PathLenArrayMaxLen : 6
[2023-7]--[ Debug ]--Push Data To StAccessPath OK.
[2023-7]--[ Debug ]--Judge Vertex(1) Is Not Accessed.
[2023-7]--[ Debug ]--Judge Vertex(2) Is Accessed.
[2023-7]--[ Debug ]--Judge Vertex(3) Is Not Accessed.
[2023-7]--[ Debug ]--Clear Data To StAccessPath OK.
[2023-7]--[ Debug ]--(StartVertexIndex : 2, EndVertexIndex : 3, Weight : 5)
[2023-7]--[ Debug ]--Push Data To StAccessPath OK.
[2023-7]--[ Debug ]--Judge Vertex(4) Is Not Accessed.
[2023-7]--[ Debug ]--Judge Vertex(5) Is Not Accessed.
[2023-7]--[ Debug ]--Judge Vertex(6) Is Not Accessed.
[2023-7]--[ Debug ]--Push Data To Lowest Edge Array OK.
[2023-7]--[ Debug ]--Printf StDijkstra
LowestEdgeArray    :
  0 : (EndVertextIndex :   1, WeightVal :    13), [ (0,1,13) ]
  1 : (EndVertextIndex :   2, WeightVal :     8), [ (0,2,8) ]
  2 : (EndVertextIndex :   3, WeightVal :    13), [ (2,3,5) ]
  3 : (EndVertextIndex :   4, WeightVal :    30), [ (0,4,30) ]
  4 : (EndVertextIndex :   5, WeightVal : 32767), [ ]
  5 : (EndVertextIndex :   6, WeightVal :    32), [ (0,6,32) ]
PathLenArray       : [ (0,2,8),(0,1,13) ]
PathLenArrayLen    : 2
PathLenArrayMaxLen : 6
[2023-7]--[ Debug ]--Push Data To StAccessPath OK.
[2023-7]--[ Debug ]--Judge Vertex(1) Is Accessed.
[2023-7]--[ Debug ]--Judge Vertex(2) Is Accessed.
[2023-7]--[ Debug ]--Judge Vertex(3) Is Not Accessed.
[2023-7]--[ Debug ]--Judge Vertex(4) Is Not Accessed.
[2023-7]--[ Debug ]--Judge Vertex(5) Is Not Accessed.
[2023-7]--[ Debug ]--Clear Data To StAccessPath OK.
[2023-7]--[ Debug ]--(StartVertexIndex : 1, EndVertexIndex : 5, Weight : 9)
[2023-7]--[ Debug ]--Push Data To StAccessPath OK.
[2023-7]--[ Debug ]--Judge Vertex(6) Is Not Accessed.
[2023-7]--[ Debug ]--Clear Data To StAccessPath OK.
[2023-7]--[ Debug ]--(StartVertexIndex : 1, EndVertexIndex : 6, Weight : 7)
[2023-7]--[ Debug ]--Push Data To StAccessPath OK.
[2023-7]--[ Debug ]--Push Data To Lowest Edge Array OK.
[2023-7]--[ Debug ]--Printf StDijkstra
LowestEdgeArray    :
  0 : (EndVertextIndex :   1, WeightVal :    13), [ (0,1,13) ]
  1 : (EndVertextIndex :   2, WeightVal :     8), [ (0,2,8) ]
  2 : (EndVertextIndex :   3, WeightVal :    13), [ (2,3,5) ]
  3 : (EndVertextIndex :   4, WeightVal :    30), [ (0,4,30) ]
  4 : (EndVertextIndex :   5, WeightVal :    22), [ (1,5,9) ]
  5 : (EndVertextIndex :   6, WeightVal :    20), [ (1,6,7) ]
PathLenArray       : [ (0,2,8),(0,1,13),(0,3,13) ]
PathLenArrayLen    : 3
PathLenArrayMaxLen : 6
[2023-7]--[ Debug ]--Push Data To StAccessPath OK.
[2023-7]--[ Debug ]--Judge Vertex(1) Is Accessed.
[2023-7]--[ Debug ]--Judge Vertex(2) Is Accessed.
[2023-7]--[ Debug ]--Judge Vertex(3) Is Accessed.
[2023-7]--[ Debug ]--Judge Vertex(4) Is Not Accessed.
[2023-7]--[ Debug ]--Clear Data To StAccessPath OK.
[2023-7]--[ Debug ]--(StartVertexIndex : 3, EndVertexIndex : 4, Weight : 6)
[2023-7]--[ Debug ]--Push Data To StAccessPath OK.
[2023-7]--[ Debug ]--Judge Vertex(5) Is Not Accessed.
[2023-7]--[ Debug ]--Judge Vertex(6) Is Not Accessed.
[2023-7]--[ Debug ]--Push Data To Lowest Edge Array OK.
[2023-7]--[ Debug ]--Printf StDijkstra
LowestEdgeArray    :
  0 : (EndVertextIndex :   1, WeightVal :    13), [ (0,1,13) ]
  1 : (EndVertextIndex :   2, WeightVal :     8), [ (0,2,8) ]
  2 : (EndVertextIndex :   3, WeightVal :    13), [ (2,3,5) ]
  3 : (EndVertextIndex :   4, WeightVal :    19), [ (3,4,6) ]
  4 : (EndVertextIndex :   5, WeightVal :    22), [ (1,5,9) ]
  5 : (EndVertextIndex :   6, WeightVal :    20), [ (1,6,7) ]
PathLenArray       : [ (0,2,8),(0,1,13),(0,3,13),(0,4,19) ]
PathLenArrayLen    : 4
PathLenArrayMaxLen : 6
[2023-7]--[ Debug ]--Push Data To StAccessPath OK.
[2023-7]--[ Debug ]--Judge Vertex(1) Is Accessed.
[2023-7]--[ Debug ]--Judge Vertex(2) Is Accessed.
[2023-7]--[ Debug ]--Judge Vertex(3) Is Accessed.
[2023-7]--[ Debug ]--Judge Vertex(4) Is Accessed.
[2023-7]--[ Debug ]--Judge Vertex(5) Is Not Accessed.
[2023-7]--[ Debug ]--Clear Data To StAccessPath OK.
[2023-7]--[ Debug ]--(StartVertexIndex : 4, EndVertexIndex : 5, Weight : 2)
[2023-7]--[ Debug ]--Push Data To StAccessPath OK.
[2023-7]--[ Debug ]--Judge Vertex(6) Is Not Accessed.
[2023-7]--[ Debug ]--Push Data To Lowest Edge Array OK.
[2023-7]--[ Debug ]--Printf StDijkstra
LowestEdgeArray    :
  0 : (EndVertextIndex :   1, WeightVal :    13), [ (0,1,13) ]
  1 : (EndVertextIndex :   2, WeightVal :     8), [ (0,2,8) ]
  2 : (EndVertextIndex :   3, WeightVal :    13), [ (2,3,5) ]
  3 : (EndVertextIndex :   4, WeightVal :    19), [ (3,4,6) ]
  4 : (EndVertextIndex :   5, WeightVal :    21), [ (4,5,2) ]
  5 : (EndVertextIndex :   6, WeightVal :    20), [ (1,6,7) ]
PathLenArray       : [ (0,2,8),(0,1,13),(0,3,13),(0,4,19),(0,6,20) ]
PathLenArrayLen    : 5
PathLenArrayMaxLen : 6
[2023-7]--[ Debug ]--Push Data To StAccessPath OK.
[2023-7]--[ Debug ]--Judge Vertex(1) Is Accessed.
[2023-7]--[ Debug ]--Judge Vertex(2) Is Accessed.
[2023-7]--[ Debug ]--Judge Vertex(3) Is Accessed.
[2023-7]--[ Debug ]--Judge Vertex(4) Is Accessed.
[2023-7]--[ Debug ]--Judge Vertex(5) Is Not Accessed.
[2023-7]--[ Debug ]--Judge Vertex(6) Is Accessed.
[2023-7]--[ Debug ]--Push Data To Lowest Edge Array OK.
[2023-7]--[ Debug ]--Printf StDijkstra
LowestEdgeArray    :
  0 : (EndVertextIndex :   1, WeightVal :    13), [ (0,1,13) ]
  1 : (EndVertextIndex :   2, WeightVal :     8), [ (0,2,8) ]
  2 : (EndVertextIndex :   3, WeightVal :    13), [ (2,3,5) ]
  3 : (EndVertextIndex :   4, WeightVal :    19), [ (3,4,6) ]
  4 : (EndVertextIndex :   5, WeightVal :    21), [ (4,5,2) ]
  5 : (EndVertextIndex :   6, WeightVal :    20), [ (1,6,7) ]
PathLenArray       : [ (0,2,8),(0,1,13),(0,3,13),(0,4,19),(0,6,20),(0,5,21) ]
PathLenArrayLen    : 6
PathLenArrayMaxLen : 6
[2023-7]--[ Debug ]--Push Data To StAccessPath OK.
[2023-7]--[ Debug ]--No Need To Traverse, Find OK, i : 0, StartVertexIndex : 0
[2023-7]--[ Debug ]--Push Data To StDijkstraAccees OK.
[2023-7]--[ Debug ]--No Need To Traverse, Find OK, i : 1, StartVertexIndex : 0
[2023-7]--[ Debug ]--Push Data To StDijkstraAccees OK.
[2023-7]--[ Debug ]--Push Data To StDijkstraAccees OK.
[2023-7]--[ Debug ]--(0,0,1,0,0,0)
[2023-7]--[ Debug ]--j : 0, TmpIndex : 2, CmpIndex : 1,StartVertexIndex : 0
[2023-7]--[ Debug ]--(0,0,1,0,0,0)
[2023-7]--[ Debug ]--j : 1, TmpIndex : 2, CmpIndex : 2,StartVertexIndex : 0
[2023-7]--[ Debug ]--Push Data To StDijkstraAccees OK.
[2023-7]--[ Debug ]--Push Data To StDijkstraAccees OK.
[2023-7]--[ Debug ]--(0,0,0,1,0,0)
[2023-7]--[ Debug ]--j : 0, TmpIndex : 3, CmpIndex : 1,StartVertexIndex : 0
[2023-7]--[ Debug ]--(0,0,0,1,0,0)
[2023-7]--[ Debug ]--j : 1, TmpIndex : 3, CmpIndex : 2,StartVertexIndex : 0
[2023-7]--[ Debug ]--(0,0,0,1,0,0)
[2023-7]--[ Debug ]--j : 2, TmpIndex : 3, CmpIndex : 3,StartVertexIndex : 0
[2023-7]--[ Debug ]--Push Data To StDijkstraAccees OK.
[2023-7]--[ Debug ]--(0,0,1,1,0,0)
[2023-7]--[ Debug ]--j : 0, TmpIndex : 2, CmpIndex : 1,StartVertexIndex : 0
[2023-7]--[ Debug ]--(0,0,1,1,0,0)
[2023-7]--[ Debug ]--j : 1, TmpIndex : 2, CmpIndex : 2,StartVertexIndex : 0
[2023-7]--[ Debug ]--Push Data To StDijkstraAccees OK.
[2023-7]--[ Debug ]--Push Data To StDijkstraAccees OK.
[2023-7]--[ Debug ]--(0,0,0,0,1,0)
[2023-7]--[ Debug ]--j : 0, TmpIndex : 4, CmpIndex : 1,StartVertexIndex : 0
[2023-7]--[ Debug ]--(0,0,0,0,1,0)
[2023-7]--[ Debug ]--j : 1, TmpIndex : 4, CmpIndex : 2,StartVertexIndex : 0
[2023-7]--[ Debug ]--(0,0,0,0,1,0)
[2023-7]--[ Debug ]--j : 2, TmpIndex : 4, CmpIndex : 3,StartVertexIndex : 0
[2023-7]--[ Debug ]--(0,0,0,0,1,0)
[2023-7]--[ Debug ]--j : 3, TmpIndex : 4, CmpIndex : 4,StartVertexIndex : 0
[2023-7]--[ Debug ]--Push Data To StDijkstraAccees OK.
[2023-7]--[ Debug ]--(0,0,0,1,1,0)
[2023-7]--[ Debug ]--j : 0, TmpIndex : 3, CmpIndex : 1,StartVertexIndex : 0
[2023-7]--[ Debug ]--(0,0,0,1,1,0)
[2023-7]--[ Debug ]--j : 1, TmpIndex : 3, CmpIndex : 2,StartVertexIndex : 0
[2023-7]--[ Debug ]--(0,0,0,1,1,0)
[2023-7]--[ Debug ]--j : 2, TmpIndex : 3, CmpIndex : 3,StartVertexIndex : 0
[2023-7]--[ Debug ]--Push Data To StDijkstraAccees OK.
[2023-7]--[ Debug ]--(0,0,1,1,1,0)
[2023-7]--[ Debug ]--j : 0, TmpIndex : 2, CmpIndex : 1,StartVertexIndex : 0
[2023-7]--[ Debug ]--(0,0,1,1,1,0)
[2023-7]--[ Debug ]--j : 1, TmpIndex : 2, CmpIndex : 2,StartVertexIndex : 0
[2023-7]--[ Debug ]--Push Data To StDijkstraAccees OK.
[2023-7]--[ Debug ]--Push Data To StDijkstraAccees OK.
[2023-7]--[ Debug ]--(0,0,0,0,0,1)
[2023-7]--[ Debug ]--j : 0, TmpIndex : 1, CmpIndex : 1,StartVertexIndex : 0
[2023-7]--[ Debug ]--Push Data To StDijkstraAccees OK.
[2023-7]--[ Debug ]--Statistics StDijkstraAccees OK.
[2023-7]--[ Debug ]--Destroy StAccessPath OK.
[2023-7]--[ Debug ]--Destroy StAccessPath OK.
[2023-7]--[ Debug ]--Destroy StAccessPath OK.
[2023-7]--[ Debug ]--Destroy StAccessPath OK.
[2023-7]--[ Debug ]--Destroy StAccessPath OK.
[2023-7]--[ Debug ]--Destroy StAccessPath OK.
[2023-7]--[ Debug ]--Destroy StDijkstra OK.
[2023-7]--[ Debug ]--Dijkstra Algorithm OK.
[2023-7]--[ Debug ]--Printf StDijkstra
AccessPath         :
[ (0,1,13) ]
[ (0,2,8) ]
[ (2,3,5),(0,2,8) ]
[ (3,4,6),(2,3,5),(0,2,8) ]
[ (4,5,2),(3,4,6),(2,3,5),(0,2,8) ]
[ (1,6,7),(0,1,13) ]
AccessPathMaxLen : 6
[2023-7]--[ Debug ]--Destroy StAccessPath OK.
[2023-7]--[ Debug ]--Destroy StAccessPath OK.
[2023-7]--[ Debug ]--Destroy StAccessPath OK.
[2023-7]--[ Debug ]--Destroy StAccessPath OK.
[2023-7]--[ Debug ]--Destroy StAccessPath OK.
[2023-7]--[ Debug ]--Destroy StAccessPath OK.
[2023-7]--[ Debug ]--Destroy StDijkstraAccees OK.
[2023-7]--[ Debug ]--Destroy Net Data                   : OK
[2023-7]--[ Debug ]--Destroy Net Use AMGraph            : OK
[2023-7]--[ Debug ]--Destroy Net Use AGraph             : OK

2、起点为1

[root@czg2 Graph]# ./TestGraph 
[2023-7]--[ Debug ]--Create Net Data                    : OK
[2023-7]--[ Debug ]--Create Net Use AMGraph             : OK
[2023-7]--[ Debug ]--Printf AMGraph                     :
VertexArray    : [0 ,1 ,2 ,3 ,4 ,5 ,6 ]
ArcArray       :
[32767 ,13    ,8     ,32767 ,30    ,32767 ,32    ]
[32767 ,32767 ,32767 ,32767 ,32767 ,9     ,7     ]
[32767 ,32767 ,32767 ,5     ,32767 ,32767 ,32767 ]
[32767 ,32767 ,32767 ,32767 ,6     ,32767 ,32767 ]
[32767 ,32767 ,32767 ,32767 ,32767 ,2     ,32767 ]
[32767 ,32767 ,32767 ,32767 ,32767 ,32767 ,17    ]
[32767 ,32767 ,32767 ,32767 ,32767 ,32767 ,32767 ]
CurVertexNum   : 7
CurArcNum      : 10
[2023-7]--[ Debug ]--Create Net Use AGraph              : OK
[2023-7]--[ Debug ]--Printf AGraph                      :
0 : [ (6, 32, 0x18e68d0),(4, 30, 0x18e68b0),(2, 8, 0x18e6890),(1, 13, (nil))]
1 : [ (6, 7, 0x18e6910),(5, 9, (nil))]
2 : [ (3, 5, (nil))]
3 : [ (4, 6, (nil))]
4 : [ (5, 2, (nil))]
5 : [ (6, 17, (nil))]
6 : []
VertexNum      : 7
ArcNum         : 10
[2023-7]--[ Debug ]--Traverse Use AMGraph               : [6 ]
[2023-7]--[ Debug ]--Traverse Use AGraph                : [6 ]
[2023-7]--[ Debug ]--Init SqQueue Normal
[2023-7]--[ Debug ]--Enter SqQueue Normal
[2023-7]--[ Debug ]--Leave SqQueue Normal
[2023-7]--[ Debug ]--Destroy SqQueue Normal
[2023-7]--[ Debug ]--Breadth First Search Use AMGraph OK
[2023-7]--[ Debug ]--Traverse Use AMGraph               : [6 ]
[2023-7]--[ Debug ]--Init SqQueue Normal
[2023-7]--[ Debug ]--Enter SqQueue Normal
[2023-7]--[ Debug ]--Leave SqQueue Normal
[2023-7]--[ Debug ]--Destroy SqQueue Normal
[2023-7]--[ Debug ]--Breadth First Search Use AGraph OK
[2023-7]--[ Debug ]--Traverse Use AGraph                : [6 ]
[2023-7]--[ Debug ]--Init WeightSortList OK
[2023-7]--[ Debug ]--Kluskal WeightSort OK
[2023-7]--[ Debug ]--Printf WeightSortList
Data : [(4, 5, 2, 0x18e6cb0),(2, 3, 5, 0x18e6cd0),(3, 4, 6, 0x18e6c70),(1, 6, 7, 0x18e6c30),(0, 2, 8, 0x18e6c90),(1, 5, 9, 0x18e6c50),(0, 1, 13, 0x18e6d10),(5, 6, 17, 0x18e6c10),(0, 4, 30, 0x18e6bf0),(0, 6, 32, 0x18e6cf0)]
NodeCnt : 10
[2023-7]--[ Debug ]--Printf Parent Array
{ -1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 }
[2023-7]--[ Debug ]--Printf Parent Array
{ -1 ,-1 ,-1 ,-1 ,-1 ,4 ,-1 }
[2023-7]--[ Debug ]--Printf Parent Array
{ -1 ,-1 ,-1 ,2 ,-1 ,4 ,-1 }
[2023-7]--[ Debug ]--Printf Parent Array
{ -1 ,-1 ,-1 ,2 ,2 ,4 ,-1 }
[2023-7]--[ Debug ]--Printf Parent Array
{ -1 ,-1 ,-1 ,2 ,2 ,4 ,1 }
[2023-7]--[ Debug ]--Printf Parent Array
{ -1 ,-1 ,0 ,2 ,2 ,4 ,1 }
[2023-7]--[ Debug ]--Destroy WeightSortList OK
[2023-7]--[ Info  ]--Kluskal Create MST OK
[2023-7]--[ Debug ]--Printf MST
{ (4,5,2),(2,3,5),(3,4,6),(1,6,7),(0,2,8),(1,5,9)}
[2023-7]--[ Debug ]--Printf ShortestEdgeArray
{(0,0),(0,13),(0,8),(0,32767),(0,30),(0,32767),(0,32)}
ArrayLen    : 1
ArrayMaxLen : 7
[2023-7]--[ Debug ]--Init ShortestEdgeArray OK
LowestEdgeVertexIndex : 2
[2023-7]--[ Debug ]--Printf ShortestEdgeArray
{(0,0),(0,13),(0,0),(2,5),(0,30),(0,32767),(0,32)}
ArrayLen    : 2
ArrayMaxLen : 7
LowestEdgeVertexIndex : 3
[2023-7]--[ Debug ]--Printf ShortestEdgeArray
{(0,0),(0,13),(0,0),(2,0),(3,6),(0,32767),(0,32)}
ArrayLen    : 3
ArrayMaxLen : 7
LowestEdgeVertexIndex : 4
[2023-7]--[ Debug ]--Printf ShortestEdgeArray
{(0,0),(0,13),(0,0),(2,0),(3,0),(4,2),(0,32)}
ArrayLen    : 4
ArrayMaxLen : 7
LowestEdgeVertexIndex : 5
[2023-7]--[ Debug ]--Printf ShortestEdgeArray
{(0,0),(0,13),(0,0),(2,0),(3,0),(4,0),(5,17)}
ArrayLen    : 5
ArrayMaxLen : 7
LowestEdgeVertexIndex : 1
[2023-7]--[ Debug ]--Printf ShortestEdgeArray
{(0,0),(0,0),(0,0),(2,0),(3,0),(4,0),(1,7)}
ArrayLen    : 6
ArrayMaxLen : 7
LowestEdgeVertexIndex : 6
[2023-7]--[ Debug ]--Destroy ShortestEdgeArray OK
[2023-7]--[ Info  ]--Prim Create MST OK
[2023-7]--[ Debug ]--Printf MST
{ (0,2,8),(2,3,5),(3,4,6),(4,5,2),(0,1,13),(1,6,7)}
[2023-7]--[ Debug ]--Init StAccessPath OK.
[2023-7]--[ Debug ]--Init StAccessPath OK.
[2023-7]--[ Debug ]--Init StAccessPath OK.
[2023-7]--[ Debug ]--Init StAccessPath OK.
[2023-7]--[ Debug ]--Init StAccessPath OK.
[2023-7]--[ Debug ]--Init StAccessPath OK.
[2023-7]--[ Debug ]--Init StDijkstraAccees OK.
[2023-7]--[ Debug ]--Init StAccessPath OK.
[2023-7]--[ Debug ]--Init StAccessPath OK.
[2023-7]--[ Debug ]--Init StAccessPath OK.
[2023-7]--[ Debug ]--Init StAccessPath OK.
[2023-7]--[ Debug ]--Init StAccessPath OK.
[2023-7]--[ Debug ]--Init StAccessPath OK.
[2023-7]--[ Debug ]--Init StDijkstra OK.
[2023-7]--[ Debug ]--(StartVertexIndex : 1, EndVertexIndex : 5, Weight : 9)
[2023-7]--[ Debug ]--Push Data To StAccessPath OK.
[2023-7]--[ Debug ]--(StartVertexIndex : 1, EndVertexIndex : 6, Weight : 7)
[2023-7]--[ Debug ]--Push Data To StAccessPath OK.
[2023-7]--[ Debug ]--Push Data To Lowest Edge Array OK.
[2023-7]--[ Debug ]--Printf StDijkstra
LowestEdgeArray    :
  0 : (EndVertextIndex :   0, WeightVal : 32767), [ ]
  1 : (EndVertextIndex :   2, WeightVal : 32767), [ ]
  2 : (EndVertextIndex :   3, WeightVal : 32767), [ ]
  3 : (EndVertextIndex :   4, WeightVal : 32767), [ ]
  4 : (EndVertextIndex :   5, WeightVal :     9), [ (1,5,9) ]
  5 : (EndVertextIndex :   6, WeightVal :     7), [ (1,6,7) ]
PathLenArray       : [ (1,6,7) ]
PathLenArrayLen    : 1
PathLenArrayMaxLen : 6
[2023-7]--[ Debug ]--Push Data To StAccessPath OK.
[2023-7]--[ Debug ]--Judge Vertex(0) Is Not Accessed.
[2023-7]--[ Debug ]--Judge Vertex(2) Is Not Accessed.
[2023-7]--[ Debug ]--Judge Vertex(3) Is Not Accessed.
[2023-7]--[ Debug ]--Judge Vertex(4) Is Not Accessed.
[2023-7]--[ Debug ]--Judge Vertex(5) Is Not Accessed.
[2023-7]--[ Debug ]--Judge Vertex(6) Is Accessed.
[2023-7]--[ Debug ]--Push Data To Lowest Edge Array OK.
[2023-7]--[ Debug ]--Printf StDijkstra
LowestEdgeArray    :
  0 : (EndVertextIndex :   0, WeightVal : 32767), [ ]
  1 : (EndVertextIndex :   2, WeightVal : 32767), [ ]
  2 : (EndVertextIndex :   3, WeightVal : 32767), [ ]
  3 : (EndVertextIndex :   4, WeightVal : 32767), [ ]
  4 : (EndVertextIndex :   5, WeightVal :     9), [ (1,5,9) ]
  5 : (EndVertextIndex :   6, WeightVal :     7), [ (1,6,7) ]
PathLenArray       : [ (1,6,7),(1,5,9) ]
PathLenArrayLen    : 2
PathLenArrayMaxLen : 6
[2023-7]--[ Debug ]--Push Data To StAccessPath OK.
[2023-7]--[ Debug ]--Judge Vertex(0) Is Not Accessed.
[2023-7]--[ Debug ]--Judge Vertex(2) Is Not Accessed.
[2023-7]--[ Debug ]--Judge Vertex(3) Is Not Accessed.
[2023-7]--[ Debug ]--Judge Vertex(4) Is Not Accessed.
[2023-7]--[ Debug ]--Judge Vertex(5) Is Accessed.
[2023-7]--[ Debug ]--Judge Vertex(6) Is Accessed.
[2023-7]--[ Debug ]--Push Data To Lowest Edge Array OK.
[2023-7]--[ Debug ]--ReturnWeightVal : 32767, Find All Access Path Ahead Of Time.
[2023-7]--[ Debug ]--No Need To Traverse, Find OK, i : 4, StartVertexIndex : 1
[2023-7]--[ Debug ]--Push Data To StDijkstraAccees OK.
[2023-7]--[ Debug ]--No Need To Traverse, Find OK, i : 5, StartVertexIndex : 1
[2023-7]--[ Debug ]--Push Data To StDijkstraAccees OK.
[2023-7]--[ Debug ]--Statistics StDijkstraAccees OK.
[2023-7]--[ Debug ]--Destroy StAccessPath OK.
[2023-7]--[ Debug ]--Destroy StAccessPath OK.
[2023-7]--[ Debug ]--Destroy StAccessPath OK.
[2023-7]--[ Debug ]--Destroy StAccessPath OK.
[2023-7]--[ Debug ]--Destroy StAccessPath OK.
[2023-7]--[ Debug ]--Destroy StAccessPath OK.
[2023-7]--[ Debug ]--Destroy StDijkstra OK.
[2023-7]--[ Debug ]--Dijkstra Algorithm OK.
[2023-7]--[ Debug ]--Printf StDijkstra
AccessPath         :
[ ]
[ ]
[ ]
[ ]
[ (1,5,9) ]
[ (1,6,7) ]
AccessPathMaxLen : 6
[2023-7]--[ Debug ]--Destroy StAccessPath OK.
[2023-7]--[ Debug ]--Destroy StAccessPath OK.
[2023-7]--[ Debug ]--Destroy StAccessPath OK.
[2023-7]--[ Debug ]--Destroy StAccessPath OK.
[2023-7]--[ Debug ]--Destroy StAccessPath OK.
[2023-7]--[ Debug ]--Destroy StAccessPath OK.
[2023-7]--[ Debug ]--Destroy StDijkstraAccees OK.
[2023-7]--[ Debug ]--Destroy Net Data                   : OK
[2023-7]--[ Debug ]--Destroy Net Use AMGraph            : OK
[2023-7]--[ Debug ]--Destroy Net Use AGraph             : OK

3、起点为3

[root@czg2 Graph]# ./TestGraph 
[2023-7]--[ Debug ]--Create Net Data                    : OK
[2023-7]--[ Debug ]--Create Net Use AMGraph             : OK
[2023-7]--[ Debug ]--Printf AMGraph                     :
VertexArray    : [0 ,1 ,2 ,3 ,4 ,5 ,6 ]
ArcArray       :
[32767 ,13    ,8     ,32767 ,30    ,32767 ,32    ]
[32767 ,32767 ,32767 ,32767 ,32767 ,9     ,7     ]
[32767 ,32767 ,32767 ,5     ,32767 ,32767 ,32767 ]
[32767 ,32767 ,32767 ,32767 ,6     ,32767 ,32767 ]
[32767 ,32767 ,32767 ,32767 ,32767 ,2     ,32767 ]
[32767 ,32767 ,32767 ,32767 ,32767 ,32767 ,17    ]
[32767 ,32767 ,32767 ,32767 ,32767 ,32767 ,32767 ]
CurVertexNum   : 7
CurArcNum      : 10
[2023-7]--[ Debug ]--Create Net Use AGraph              : OK
[2023-7]--[ Debug ]--Printf AGraph                      :
0 : [ (6, 32, 0xdcd8d0),(4, 30, 0xdcd8b0),(2, 8, 0xdcd890),(1, 13, (nil))]
1 : [ (6, 7, 0xdcd910),(5, 9, (nil))]
2 : [ (3, 5, (nil))]
3 : [ (4, 6, (nil))]
4 : [ (5, 2, (nil))]
5 : [ (6, 17, (nil))]
6 : []
VertexNum      : 7
ArcNum         : 10
[2023-7]--[ Debug ]--Traverse Use AMGraph               : [6 ]
[2023-7]--[ Debug ]--Traverse Use AGraph                : [6 ]
[2023-7]--[ Debug ]--Init SqQueue Normal
[2023-7]--[ Debug ]--Enter SqQueue Normal
[2023-7]--[ Debug ]--Leave SqQueue Normal
[2023-7]--[ Debug ]--Destroy SqQueue Normal
[2023-7]--[ Debug ]--Breadth First Search Use AMGraph OK
[2023-7]--[ Debug ]--Traverse Use AMGraph               : [6 ]
[2023-7]--[ Debug ]--Init SqQueue Normal
[2023-7]--[ Debug ]--Enter SqQueue Normal
[2023-7]--[ Debug ]--Leave SqQueue Normal
[2023-7]--[ Debug ]--Destroy SqQueue Normal
[2023-7]--[ Debug ]--Breadth First Search Use AGraph OK
[2023-7]--[ Debug ]--Traverse Use AGraph                : [6 ]
[2023-7]--[ Debug ]--Init WeightSortList OK
[2023-7]--[ Debug ]--Kluskal WeightSort OK
[2023-7]--[ Debug ]--Printf WeightSortList
Data : [(4, 5, 2, 0xdcdcb0),(2, 3, 5, 0xdcdcd0),(3, 4, 6, 0xdcdc70),(1, 6, 7, 0xdcdc30),(0, 2, 8, 0xdcdc90),(1, 5, 9, 0xdcdc50),(0, 1, 13, 0xdcdd10),(5, 6, 17, 0xdcdc10),(0, 4, 30, 0xdcdbf0),(0, 6, 32, 0xdcdcf0)]
NodeCnt : 10
[2023-7]--[ Debug ]--Printf Parent Array
{ -1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 }
[2023-7]--[ Debug ]--Printf Parent Array
{ -1 ,-1 ,-1 ,-1 ,-1 ,4 ,-1 }
[2023-7]--[ Debug ]--Printf Parent Array
{ -1 ,-1 ,-1 ,2 ,-1 ,4 ,-1 }
[2023-7]--[ Debug ]--Printf Parent Array
{ -1 ,-1 ,-1 ,2 ,2 ,4 ,-1 }
[2023-7]--[ Debug ]--Printf Parent Array
{ -1 ,-1 ,-1 ,2 ,2 ,4 ,1 }
[2023-7]--[ Debug ]--Printf Parent Array
{ -1 ,-1 ,0 ,2 ,2 ,4 ,1 }
[2023-7]--[ Debug ]--Destroy WeightSortList OK
[2023-7]--[ Info  ]--Kluskal Create MST OK
[2023-7]--[ Debug ]--Printf MST
{ (4,5,2),(2,3,5),(3,4,6),(1,6,7),(0,2,8),(1,5,9)}
[2023-7]--[ Debug ]--Printf ShortestEdgeArray
{(0,0),(0,13),(0,8),(0,32767),(0,30),(0,32767),(0,32)}
ArrayLen    : 1
ArrayMaxLen : 7
[2023-7]--[ Debug ]--Init ShortestEdgeArray OK
LowestEdgeVertexIndex : 2
[2023-7]--[ Debug ]--Printf ShortestEdgeArray
{(0,0),(0,13),(0,0),(2,5),(0,30),(0,32767),(0,32)}
ArrayLen    : 2
ArrayMaxLen : 7
LowestEdgeVertexIndex : 3
[2023-7]--[ Debug ]--Printf ShortestEdgeArray
{(0,0),(0,13),(0,0),(2,0),(3,6),(0,32767),(0,32)}
ArrayLen    : 3
ArrayMaxLen : 7
LowestEdgeVertexIndex : 4
[2023-7]--[ Debug ]--Printf ShortestEdgeArray
{(0,0),(0,13),(0,0),(2,0),(3,0),(4,2),(0,32)}
ArrayLen    : 4
ArrayMaxLen : 7
LowestEdgeVertexIndex : 5
[2023-7]--[ Debug ]--Printf ShortestEdgeArray
{(0,0),(0,13),(0,0),(2,0),(3,0),(4,0),(5,17)}
ArrayLen    : 5
ArrayMaxLen : 7
LowestEdgeVertexIndex : 1
[2023-7]--[ Debug ]--Printf ShortestEdgeArray
{(0,0),(0,0),(0,0),(2,0),(3,0),(4,0),(1,7)}
ArrayLen    : 6
ArrayMaxLen : 7
LowestEdgeVertexIndex : 6
[2023-7]--[ Debug ]--Destroy ShortestEdgeArray OK
[2023-7]--[ Info  ]--Prim Create MST OK
[2023-7]--[ Debug ]--Printf MST
{ (0,2,8),(2,3,5),(3,4,6),(4,5,2),(0,1,13),(1,6,7)}
[2023-7]--[ Debug ]--Init StAccessPath OK.
[2023-7]--[ Debug ]--Init StAccessPath OK.
[2023-7]--[ Debug ]--Init StAccessPath OK.
[2023-7]--[ Debug ]--Init StAccessPath OK.
[2023-7]--[ Debug ]--Init StAccessPath OK.
[2023-7]--[ Debug ]--Init StAccessPath OK.
[2023-7]--[ Debug ]--Init StDijkstraAccees OK.
[2023-7]--[ Debug ]--Init StAccessPath OK.
[2023-7]--[ Debug ]--Init StAccessPath OK.
[2023-7]--[ Debug ]--Init StAccessPath OK.
[2023-7]--[ Debug ]--Init StAccessPath OK.
[2023-7]--[ Debug ]--Init StAccessPath OK.
[2023-7]--[ Debug ]--Init StAccessPath OK.
[2023-7]--[ Debug ]--Init StDijkstra OK.
[2023-7]--[ Debug ]--(StartVertexIndex : 3, EndVertexIndex : 4, Weight : 6)
[2023-7]--[ Debug ]--Push Data To StAccessPath OK.
[2023-7]--[ Debug ]--Push Data To Lowest Edge Array OK.
[2023-7]--[ Debug ]--Printf StDijkstra
LowestEdgeArray    :
  0 : (EndVertextIndex :   0, WeightVal : 32767), [ ]
  1 : (EndVertextIndex :   1, WeightVal : 32767), [ ]
  2 : (EndVertextIndex :   2, WeightVal : 32767), [ ]
  3 : (EndVertextIndex :   4, WeightVal :     6), [ (3,4,6) ]
  4 : (EndVertextIndex :   5, WeightVal : 32767), [ ]
  5 : (EndVertextIndex :   6, WeightVal : 32767), [ ]
PathLenArray       : [ (3,4,6) ]
PathLenArrayLen    : 1
PathLenArrayMaxLen : 6
[2023-7]--[ Debug ]--Push Data To StAccessPath OK.
[2023-7]--[ Debug ]--Judge Vertex(0) Is Not Accessed.
[2023-7]--[ Debug ]--Judge Vertex(1) Is Not Accessed.
[2023-7]--[ Debug ]--Judge Vertex(2) Is Not Accessed.
[2023-7]--[ Debug ]--Judge Vertex(4) Is Accessed.
[2023-7]--[ Debug ]--Judge Vertex(5) Is Not Accessed.
[2023-7]--[ Debug ]--Clear Data To StAccessPath OK.
[2023-7]--[ Debug ]--(StartVertexIndex : 4, EndVertexIndex : 5, Weight : 2)
[2023-7]--[ Debug ]--Push Data To StAccessPath OK.
[2023-7]--[ Debug ]--Judge Vertex(6) Is Not Accessed.
[2023-7]--[ Debug ]--Push Data To Lowest Edge Array OK.
[2023-7]--[ Debug ]--Printf StDijkstra
LowestEdgeArray    :
  0 : (EndVertextIndex :   0, WeightVal : 32767), [ ]
  1 : (EndVertextIndex :   1, WeightVal : 32767), [ ]
  2 : (EndVertextIndex :   2, WeightVal : 32767), [ ]
  3 : (EndVertextIndex :   4, WeightVal :     6), [ (3,4,6) ]
  4 : (EndVertextIndex :   5, WeightVal :     8), [ (4,5,2) ]
  5 : (EndVertextIndex :   6, WeightVal : 32767), [ ]
PathLenArray       : [ (3,4,6),(3,5,8) ]
PathLenArrayLen    : 2
PathLenArrayMaxLen : 6
[2023-7]--[ Debug ]--Push Data To StAccessPath OK.
[2023-7]--[ Debug ]--Judge Vertex(0) Is Not Accessed.
[2023-7]--[ Debug ]--Judge Vertex(1) Is Not Accessed.
[2023-7]--[ Debug ]--Judge Vertex(2) Is Not Accessed.
[2023-7]--[ Debug ]--Judge Vertex(4) Is Accessed.
[2023-7]--[ Debug ]--Judge Vertex(5) Is Accessed.
[2023-7]--[ Debug ]--Judge Vertex(6) Is Not Accessed.
[2023-7]--[ Debug ]--Clear Data To StAccessPath OK.
[2023-7]--[ Debug ]--(StartVertexIndex : 5, EndVertexIndex : 6, Weight : 17)
[2023-7]--[ Debug ]--Push Data To StAccessPath OK.
[2023-7]--[ Debug ]--Push Data To Lowest Edge Array OK.
[2023-7]--[ Debug ]--Printf StDijkstra
LowestEdgeArray    :
  0 : (EndVertextIndex :   0, WeightVal : 32767), [ ]
  1 : (EndVertextIndex :   1, WeightVal : 32767), [ ]
  2 : (EndVertextIndex :   2, WeightVal : 32767), [ ]
  3 : (EndVertextIndex :   4, WeightVal :     6), [ (3,4,6) ]
  4 : (EndVertextIndex :   5, WeightVal :     8), [ (4,5,2) ]
  5 : (EndVertextIndex :   6, WeightVal :    25), [ (5,6,17) ]
PathLenArray       : [ (3,4,6),(3,5,8),(3,6,25) ]
PathLenArrayLen    : 3
PathLenArrayMaxLen : 6
[2023-7]--[ Debug ]--Push Data To StAccessPath OK.
[2023-7]--[ Debug ]--Judge Vertex(0) Is Not Accessed.
[2023-7]--[ Debug ]--Judge Vertex(1) Is Not Accessed.
[2023-7]--[ Debug ]--Judge Vertex(2) Is Not Accessed.
[2023-7]--[ Debug ]--Judge Vertex(4) Is Accessed.
[2023-7]--[ Debug ]--Judge Vertex(5) Is Accessed.
[2023-7]--[ Debug ]--Judge Vertex(6) Is Accessed.
[2023-7]--[ Debug ]--Push Data To Lowest Edge Array OK.
[2023-7]--[ Debug ]--ReturnWeightVal : 32767, Find All Access Path Ahead Of Time.
[2023-7]--[ Debug ]--No Need To Traverse, Find OK, i : 3, StartVertexIndex : 3
[2023-7]--[ Debug ]--Push Data To StDijkstraAccees OK.
[2023-7]--[ Debug ]--Push Data To StDijkstraAccees OK.
[2023-7]--[ Debug ]--Push Data To StDijkstraAccees OK.
[2023-7]--[ Debug ]--Push Data To StDijkstraAccees OK.
[2023-7]--[ Debug ]--Push Data To StDijkstraAccees OK.
[2023-7]--[ Debug ]--Push Data To StDijkstraAccees OK.
[2023-7]--[ Debug ]--Statistics StDijkstraAccees OK.
[2023-7]--[ Debug ]--Destroy StAccessPath OK.
[2023-7]--[ Debug ]--Destroy StAccessPath OK.
[2023-7]--[ Debug ]--Destroy StAccessPath OK.
[2023-7]--[ Debug ]--Destroy StAccessPath OK.
[2023-7]--[ Debug ]--Destroy StAccessPath OK.
[2023-7]--[ Debug ]--Destroy StAccessPath OK.
[2023-7]--[ Debug ]--Destroy StDijkstra OK.
[2023-7]--[ Debug ]--Dijkstra Algorithm OK.
[2023-7]--[ Debug ]--Printf StDijkstra
AccessPath         :
[ ]
[ ]
[ ]
[ (3,4,6) ]
[ (4,5,2),(3,4,6) ]
[ (5,6,17),(4,5,2),(3,4,6) ]
AccessPathMaxLen : 6
[2023-7]--[ Debug ]--Destroy StAccessPath OK.
[2023-7]--[ Debug ]--Destroy StAccessPath OK.
[2023-7]--[ Debug ]--Destroy StAccessPath OK.
[2023-7]--[ Debug ]--Destroy StAccessPath OK.
[2023-7]--[ Debug ]--Destroy StAccessPath OK.
[2023-7]--[ Debug ]--Destroy StAccessPath OK.
[2023-7]--[ Debug ]--Destroy StDijkstraAccees OK.
[2023-7]--[ Debug ]--Destroy Net Data                   : OK
[2023-7]--[ Debug ]--Destroy Net Use AMGraph            : OK
[2023-7]--[ Debug ]--Destroy Net Use AGraph             : OK

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/805149.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

函数栈帧的创建和毁销【C语言版】

大家好&#xff0c;我是深鱼~ 【前言】前期学习的时候&#xff0c;我们可能有很多的困惑 比如&#xff1a; 局部变量是怎么创建的呢&#xff1f; 为什么局部变量的值是随机值&#xff1f; 函数是怎么传参的&#xff1f;传参的顺序是怎么样的&#xff1f; 形参和实参是什么关系…

上海亚商投顾:沪指放量大涨1.84% 证券股掀涨停潮

上海亚商投顾前言&#xff1a;无惧大盘涨跌&#xff0c;解密龙虎榜资金&#xff0c;跟踪一线游资和机构资金动向&#xff0c;识别短期热点和强势个股。 市场情绪 三大指数今日低开高走&#xff0c;沪指午后放量涨近2%&#xff0c;上证50盘中大涨超3%。大金融板块全线爆发&#…

Wireshark从下载到使用完整教程分享

surfshark如何下载呢&#xff1f;surfshark安卓&#xff0c;苹果以及电脑上使用的完整教程分享可以戳后面地址: https://qptool.net/shark.html Wireshark是一款流行的网络协议分析工具&#xff0c;用于捕获和分析网络数据包。它可以帮助网络管理员和安全专家监视和诊断网络问…

[每日习题]跳石板(动态规划) 手套(贪心)——牛客习题

hello,大家好&#xff0c;这里是bang___bang_&#xff0c;今天来记录2道习题跳石板和手套&#xff01; 目录 1️⃣跳石板 2️⃣手套 1️⃣跳石板 跳石板_牛客题霸_牛客网 (nowcoder.com) 描述 小易来到了一条石板路前&#xff0c;每块石板上从1挨着编号为&#xff1a;1、2、…

批量删除python代码中的注释

ctrlh&#xff0c;调出替换功能窗口 启用正则表达式&#xff0c;输入 (#.*) 点击替换就能删除全部的注释了

【图论】LCA(倍增)

一.LCA介绍 LCA通常指的是“最近共同祖先”&#xff08;Lowest Common Ancestor&#xff09;。LCA是一种用于解决树或图结构中两个节点的最低共同祖先的问题的算法。 在树结构中&#xff0c;LCA是指两个节点的最近层级的共同祖先节点。例如&#xff0c;考虑一棵树&#xff0c;…

16.Netty源码之ChannelPipeline

highlight: arduino-light 服务编排层:ChannelPipeline协调ChannelHandlerHandler EventLoop可以说是 Netty 的调度中心&#xff0c;负责监听多种事件类型&#xff1a;I/O 事件、信号事件、定时事件等&#xff0c;然而实际的业务处理逻辑则是由 ChannelPipeline 中所定义的 Cha…

《Elasticsearch 源码解析与优化实战》第5章:选主流程

《Elasticsearch 源码解析与优化实战》第5章&#xff1a;选主流程 - 墨天轮 一、简介 Discovery 模块负责发现集群中的节点&#xff0c;以及选择主节点。ES 支持多种不同 Discovery 类型选择&#xff0c;内置的实现称为Zen Discovery ,其他的包括公有云平台亚马逊的EC2、谷歌…

C++之普通函数指针/类成员函数指针/lambda回调函数总结(一百六十八)

简介&#xff1a; CSDN博客专家&#xff0c;专注Android/Linux系统&#xff0c;分享多mic语音方案、音视频、编解码等技术&#xff0c;与大家一起成长&#xff01; 优质专栏&#xff1a;Audio工程师进阶系列【原创干货持续更新中……】&#x1f680; 人生格言&#xff1a; 人生…

边写代码边学习之卷积神经网络CNN

1. 卷积神经网络CNN 卷积神经网络&#xff08;Convolutional Neural Network&#xff0c;CNN&#xff09;是一种深度学习神经网络的架构&#xff0c;主要用于图像识别、图像分类和计算机视觉等任务。它是由多层神经元组成的神经网络&#xff0c;其中包含卷积层、池化层和全连接…

算法与数据结构-二分查找

文章目录 什么是二分查找二分查找的时间复杂度二分查找的代码实现简单实现&#xff1a;不重复有序数组查找目标值变体实现&#xff1a;查找第一个值等于给定值的元素变体实现&#xff1a;查找最后一个值等于给定值的元素变体实现&#xff1a;查找最后一个小于给定值的元素变体实…

【雕爷学编程】MicroPython动手做(10)——零基础学MaixPy之神经网络KPU2

KPU的基础架构 让我们回顾下经典神经网络的基础运算操作&#xff1a; 卷积&#xff08;Convolution&#xff09;:1x1卷积&#xff0c;3x3卷积&#xff0c;5x5及更高的卷积 批归一化&#xff08;Batch Normalization&#xff09; 激活&#xff08;Activate&#xff09; 池化&…

玩一玩编程式 AOP

[toc] 平时我们项目中涉及到 AOP&#xff0c;基本上就是声明式配置一下就行了&#xff0c;无论是基于 XML 的配置还是基于 Java 代码的配置&#xff0c;都是简单配置即可使用。声明式配置有一个好处就是对源代码的侵入小甚至是零侵入。不过今天松哥要和小伙伴们聊一聊编程式的 …

Chapter 9: Lists | Python for Everybody 讲义笔记_En

文章目录 Python for Everybody课程简介ListsA list is a sequenceLists are mutableTraversing a listList operationsList slicesList methodsDeleting elementsLists and functionsLists and stringsParsing linesObjects and valuesAliasingList argumentsDebuggingGlossar…

【Spring】Spring 下载及其 jar 包

根据 【动力节点】最新Spring框架教程&#xff0c;全网首套Spring6教程&#xff0c;跟老杜从零学spring入门到高级 以及老杜的原版笔记 https://www.yuque.com/docs/share/866abad4-7106-45e7-afcd-245a733b073f?# 《Spring6》 进行整理&#xff0c; 文档密码&#xff1a;mg9b…

数字签名与数字证书

数字签名与数字证书 数字签名数字证书数字证书的原理数字证书的特点 如何验证证书机构的公钥不是伪造的 数字签名 数字签名是非对称密钥加密技术与数字摘要技术的应用&#xff0c;数字签名就是用加密算法加密报文文本的摘要&#xff08;摘要通过hash函数得到&#xff09;而生成…

「回溯框架」

文章目录 0 回溯和动态规划&#xff08;dp&#xff09;的区别0.1 框架 1 刷题1.1 全排列1.1.1 题解1.1.2 Code1.1.3 结果 1.2 N皇后1.2.1 题解1.2.2 Code1.2.3 结果 0 回溯和动态规划&#xff08;dp&#xff09;的区别 动态规划的核心是穷举&#xff0c;那么回溯算法和dp有什么…

单机最快的队列Disruptor解析和使用

前言 介绍高性能队列Disruptor原理以及使用例子。 Disruptor是什么? Disruptor是外汇和加密货币交易所运营商 LMAX group 建立高性能的金融交易所的结果。用于解决生产者、消费者及其数据存储的设计问题的高性能队列实现。可以对标JDK中的ArrayBlockingQueue。是目前单机且…

IDC报告背后:大模型时代,重新理解AI公有云

大模型之于AI公有云的意义&#xff0c;在于大模型可以改变过去“手工作坊定制算法”的高成本模式&#xff0c;转向“工厂模式”&#xff0c;只需要微调和精调&#xff0c;就可以形成针对性的场景算法。 作者|葛覃 出品|产业家 一年前&#xff0c;依然有不少云计算从业者思…

基于智能状态和源代码插桩的 C 程序内存安全性动态分析

原文来自微信公众号“编程语言Lab”&#xff1a;基于智能状态和源代码插桩的 C 程序内存安全性动态分析 搜索关注“编程语言Lab”公众号&#xff08;HW-PLLab&#xff09;获取更多技术内容&#xff01; 欢迎加入 编程语言社区 SIG-程序分析 参与交流讨论&#xff08;加入方式&a…