const int MaxEdgeNum=16300; typedef int WeightType; const WeightType MaxValue=28; //顶点结构体 struct VertexType {
int num_d;//顶点代号 char name[20];//顶点名称 };
typedef VertexType vexlist[MaxVertexNum];
typedef int adjmatrix[MaxVertexNum][MaxVertexNum]; //定义邻接表中的边结点类型 struct edgenode {
int adjvex;
WeightType weight;
edgenode *next; };
(2)所有函数的接口描述;
//将二维数组里的数据传输给邻接矩阵 void InitMatrix( )
//将景点名称数据传输给顶点结构体 void InitVT( )
//邻接矩阵的二元组表示 void PrintMatrix( ) //PATH void PATH( )
//最短路径:狄克斯特拉 void Dijkstra( ) //输出最短路径 void Print( ) //插入路径问题
void change( )
(3)所有函数的算法描述(只需要写出伪码算法);
//将二维数组data[][ ]的数据传输给邻接矩阵GA void InitMatrix(adjmatrix &GA,int data[9][9]) {
}
GA[i][j]=data[i][j];
//将景点名称数据a[]传输给顶点结构体VT[] void InitVT(VertexType VT[9],char *a[9]) { strcpy(VT[i].name,a[i]);