当前位置: 首页 > news >正文

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

一、最短路径应用案例

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

二、最短路径问题分类

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

相关文章:

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

一、最短路径应用案例 例如从北京到上海旅游&#xff0c;有多条路可以到目的地&#xff0c;哪条路线最短&#xff0c;哪条路线最省钱&#xff0c;就是典型的最短路径问题。 二、最短路径问题分类 最短路径问题可以分为两类&#xff0c;第一类为&#xff1a;两点间最短路径。第…...

Windows Server 2012 能使用的playwright版本

由于在harkua_bot里面使用到了playwright&#xff0c;我的服务器又是Windows Server 2012 R2&#xff0c;最新版playwright不支持Windows Server 2012 R2&#xff0c;支持Windows Server 2016以上&#xff0c;所以有了这个需求 https://cdn.npmmirror.com/binaries/playwright…...

css实现溢出变为省略号

单行文本溢出省略 text-overflow&#xff1a;规定当文本溢出时&#xff0c;显示省略符号来代表被修剪的文本 white-space&#xff1a;设置文字在一行显示&#xff0c;不能换行 overflow&#xff1a;文字长度超出限定宽度&#xff0c;则隐藏超出的内容overflow设为hidden&#…...

nginx如何配置两个服务器的连接

nginx 中通过server_name listen的方式配置多个服务器 nginx配置两个站点的windows操作方法&#xff0c;双域名双站点...

Linux环境Arduino IDE中配置ATOM S3

linux选择ubuntu发行版。 硬件设备有多小呢&#xff1a; 功能超级强大。 之前的ROS1和ROS2案例已经全部移植完成并测试结束&#xff08;三轮纯人力校验&#x1f60e;&#xff09;。 官网文档信息非常非常好&#xff1a; https://docs.m5stack.com/zh_CN/quick_start/atoms3…...

【C#】.Net Framework框架下的Authorize权限类

2023年&#xff0c;第31周&#xff0c;第3篇文章。给自己一个目标&#xff0c;然后坚持总会有收货&#xff0c;不信你试试&#xff01; 在C#的.NET Framework中&#xff0c;你可以使用Authorize类来处理权限认证。Authorize类位于System.Web.Mvc命名空间中&#xff0c;它提供了…...

C++ list底层实现原理

文章目录 一、list底层实现二、类构成三、构造函数四、迭代器五、获取第一个元素六、获取最后一个元素七、插入元素 一句话&#xff1a;list底层实现一个双向循环链表 一、list底层实现 一个双向循环链表 二、类构成 class list : protected_List_base_list_base.lsit_impl…...

C#实现数字验证码

开发环境&#xff1a;VS2019&#xff0c;.NET Core 3.1&#xff0c;ASP.NET Core API 1、建立一个验证码控制器 新建两个方法Create和Check&#xff0c;Create用于创建验证码&#xff0c;Check用于验证它是否有效。 声明一个静态类变量存放列表&#xff0c;列表中存放包含令…...

Git的常用命令以及使用场景

文章目录 1.前言2.工作区,暂存区,版本库简介3.Git的常用命令4.版本回退5.撤销修改6.删除文件7.总结 1.前言 在学习Git命令之前,需要先了解工作区,暂存区和版本库这三个概念 2.工作区,暂存区,版本库简介 在使用Git进行版本控制时&#xff0c;有三个重要的概念&#xff1a;工作…...

tcp keepalive

tcp keepalive用于检查两者之间的链路是否正常&#xff0c;或防止链路断开。 一旦建立了TCP连接&#xff0c;该连接被定义为有效&#xff0c;直到一方关闭它。一旦连接进入连接状态&#xff0c;它将无限期地保持连接状态。但实际上&#xff0c;这种联系不会无限期地持续下去。如…...

PP-Matting: AI高精度图像前景Matting,让抠图轻而易举

分割和Matting的一个重要区别是:分割返回的是像素分类标签,其结果是整型数据;而Matting返回的是属于前景或背景的概率P,从而在前景与背景交互区域产生渐变的效果,使得抠图更加自然。Matting分割模型训练完成后,对于原始图像每个位置上的像素,都将生成一个表示其前景透明…...

VUE3-01

1.选项式和组合式 选项式API&#xff1a;按照作用组织代码 组合式API&#xff1a;按照功能组织代码 2.<script setup> <template><div class"about"><h1>{{name}}</h1><button click"sayHello">测试</button>…...

分库分表之基于Shardingjdbc+docker+mysql主从架构实现读写分离(二)

说明&#xff1a;如果实现了docker部署mysql并完成主从复制的话再继续&#xff0c;本篇文章主要说明springboot配置实现Shardingjdbc进行读写分离操作。 如果没实现docker部署mysql实现主从架构的话点击我 Shardingjdbc配置介绍&#xff08;版本&#xff1a;5.3.2&#xff09;…...

Python 进阶(四):日期和时间(time、datetime、calendar 模块)

❤️ 博客主页&#xff1a;水滴技术 &#x1f338; 订阅专栏&#xff1a;Python 入门核心技术 &#x1f680; 支持水滴&#xff1a;点赞&#x1f44d; 收藏⭐ 留言&#x1f4ac; 文章目录 1. time模块1.1 获取当前时间1.2 时间休眠1.3 格式化时间 2. datetime模块2.1 获取当前…...

Transformer背景介绍

目录 Transformer的诞生Transformer的优势Transformer的市场 Transformer的诞生 论文地址 Transformer的优势 Transformer的市场...

深入理解BeanDefinition和Spring Beans

深入理解BeanDefinition和Spring Beans 引言 在Spring框架中&#xff0c;BeanDefinition和Spring Beans是非常重要的概念。BeanDefinition定义了Spring Bean的元数据&#xff0c;而Spring Beans是应用程序中的对象实例。理解BeanDefinition和Spring Beans的概念和使用方法对于…...

实验六 调度器-实验部分

目录 一、知识点 1.进程调度器设计的目标 1.1.进程的生命周期 1.2.用户进程创建与内核进程创建 1.3.进程调度器的设计目标 2.ucore 调度器框架 2.1.调度初始化 2.2.调度过程 2.2.1.调度整体流程 2.2.2.设计考虑要点 2.2.3.数据结构 2.2.4.调度框架应与调度算法无关…...

基于飞桨paddle波士顿房价预测练习模型测试代码

基于飞桨paddle波士顿房价预测练习模型测试代码 导入基础库 #paddle&#xff1a;飞桨的主库&#xff0c;paddle 根目录下保留了常用API的别名&#xff0c;当前包括&#xff1a;paddle.tensor、paddle.framework、paddle.device目录下的所有API&#xff1b; import paddle #Lin…...

只会“点点点”,凭什么让开发看的起你?

众所周知&#xff0c;如今无论是大厂还是中小厂&#xff0c;自动化测试基本是标配了&#xff0c;毕竟像双 11、618 这种活动中庞大繁杂的系统&#xff0c;以及多端发布、多版本、机型发布等需求&#xff0c;但只会“写一些自动化脚本”很难胜任。这一点在招聘要求中就能看出来。…...

35.图片幻灯片

图片幻灯片 html部分 <div class"carousel"><div class"image-container"><img src"./static/20180529205331_yhGyf.jpeg" alt"" srcset""><img src"./static/20190214214253_hsjqw.webp"…...

CentOS7系统Nvidia Docker容器基于TensorFlow2.12测试GPU

CentOS7系统Nvidia Docker容器基于TensorFlow1.15测试GPU 参考我的另一篇博客 1. 安装NVIDIA-Docker的Tensorflow2.12.0版本 1. 版本依赖对应关系&#xff1a;从源代码构建 | TensorFlow GPU 版本Python 版本编译器构建工具cuDNNCUDAtensorflow-2.6.03.6-3.9GCC 7.3.1Ba…...

Go 下载安装教程

1. 下载地址&#xff1a;The Go Programming Language (google.cn) 2. 下载安装包 3. 安装 &#xff08;1&#xff09;下一步 &#xff08;2&#xff09;同意 &#xff08;3&#xff09;修改安装路径&#xff0c;如果不修改&#xff0c;直接下一步 更改后&#xff0c;点击下一…...

InnoDB数据存储结构

一. InnoDB的数据存储结构&#xff1a;页 索引是在存储引擎中实现的&#xff0c;MySQL服务器上的存储引擎负责对表中数据的读取和写入工作。不同存储引擎中存放的格式一般不同的&#xff0c;甚至有的存储引擎比如Memory都不用磁盘来存储数据&#xff0c;这里讲讲InooDB存储引擎…...

基于ts的浏览器缓存工具封装(含源码)

cache.ts缓存工具 浏览器缓存工具封装实现使用方法示例代码 浏览器缓存工具封装 在前端开发中&#xff0c;经常会遇到需要缓存数据的情况&#xff0c;例如保存用户的登录状态、缓存部分页面数据等 但有时候需要缓存一些复杂的对象&#xff0c;例如用户信息对象、设置配置等。…...

GIT涵盖工作中用的相关指令

git安装一直默认点击下去&#xff0c;安装完成&#xff0c;右键会看见gitBash git --version 查看git安装的版本 使用git前配置git git config --global user.name 提交人姓名 git config --global user.email 提交人邮箱 git config --list 查看git配置信息 使用git中配置…...

【如何训练一个中英翻译模型】LSTM机器翻译seq2seq字符编码(一)

系列文章 【如何训练一个中英翻译模型】LSTM机器翻译seq2seq字符编码&#xff08;一&#xff09; 【如何训练一个中英翻译模型】LSTM机器翻译模型训练与保存&#xff08;二&#xff09; 【如何训练一个中英翻译模型】LSTM机器翻译模型部署&#xff08;三&#xff09; 【如何训…...

[JAVAee]文件操作-IO

本文章讲述了通过java对文件进行IO操作 IO:input/output,输入/输出. 建议配合文章末尾实例食用 目录 文件 文件的管理 文件的路径 文件的分类 文件系统的操作 File类的构造方法 File的常用方法 文件内容的读写 FileInputStream读取文件 构造方法 常用方法 Scan…...

【数据集】3小时尺度降水数据集-MSWEPV2

1 MSWEP V2 precipitation product 官网-MSWEP V2降水产品 参考...

Springboot之把外部依赖包纳入Spring容器管理的两种方式

前言 在Spring boot项目中&#xff0c;凡是标记有Component、Controller、Service、Configuration、Bean等注解的类&#xff0c;Spring boot都会在容器启动的时候&#xff0c;自动创建bean并纳入到Spring容器中进行管理&#xff0c;这样就可以使用Autowired等注解&#xff0c;…...

更安全,更省心丨DolphinDB 数据库权限管理系统使用指南

在数据库产品使用过程中&#xff0c;为保证数据不被窃取、不遭破坏&#xff0c;我们需要通过用户权限来限制用户对数据库、数据表、视图等功能的操作范围&#xff0c;以保证数据库安全性。为此&#xff0c;DolphinDB 提供了具备以下主要功能的权限管理系统&#xff1a; 提供用户…...