电脑编程问题!急急急

来源:百度知道 编辑:UC知道 时间:2024/06/17 23:18:37
用C语言描述的迪杰斯特拉算法,不过我看不到,帮忙解释下。

void ShortestPath_DIJ(MGraph G,int v0,PathMatrix &P,ShortPathTable &D)
for(v=0;v<G.vexnum;++v){
final[v]=FALSE;D[v]=G.arcs[v0][v];
for (w=0;w<G.vexnum;++w) p[v][w]=FLSE;

上面这几段主要讲什么内容,急急急。

我学过这些 迪杰斯特拉算法

void ShortestPath_DIJ(MGraph G,int v0,PathMatrix &P,ShortPathTable &D)
//用Dijkstra算法求有向网G的v0顶点到其余顶点v的最短路径P[v]及其带权长度D[v]
//若P[v][w]为TRUE,则w是从v0到v当前求得最短路径上的顶点
//final[v]为TRUE当且仅当v(-S,即已经求得从vo到v的最短路径
for(v=0;v<G.vexnum;++v){
final[v]=FALSE;D[v]=G.arcs[v0][v];
for (w=0;w<G.vexnum;++w) p[v][w]=FLSE; //设空路径

还有最后的那个是你打错了 不是FLSE 是FALSE

#include <stdio.h>
#include <stdlib.h>

#define INT_MAX 2147483647
#define INFINITY INT_MAX
#define FALSE -1
#define TRUE 1
#define NumVertices 6 //图中最大顶点个数
typedef int PathMatrix[NumVertices][NumVertices]; //最短路径数组
typedef int ShortPathTable[NumVertices]; //最短路径长度
typedef int AdjMatrix[NumVertices][NumVertices];
typedef char VertexType;
typedef struct{
VertexType vexs[NumVertices];
AdjMatrix arcs; //邻接矩阵
int vexnum,arcnum;
}MGraph;

int LocateVex(MGraph G,char