1、include
#include
using namespace std;
#define MAXV 100
#define INF 32767
typedef int InfoType;
typedef int Vertex;
typedef struct
{ int no;
InfoType info;
} VertexType; //顶点类型
typedef struct
2、
{ int edges[MAXV][MAXV];
int n,e;
VertexType vexs[MAXV];
} MGraph; //图类型
void Ppath(int path[][MAXV], int i, int j)
{ int k;
k=path[i][j];
if (k==-1) return; //递归出口
Ppath(path,i,k);
3、
cout<4、 <5、<6、
if (A[i][j]>(A[i][k]+A[k][j]))
{
A[i][j]=A[i][k]+A[k][j];
path[i][j]=k;
}
Dispath(A,path,g.n); //输出最短路径
}
void DispMat(MGraph g)
{
int i,j;
for(i=0;i7、cout <>g.n>>g.e;
cout<<"输入邻接矩阵g的元素值:\n";
for(i=0;i>g.edges[i][j];
}
cout<<"输出邻接矩阵g:\n";
DispMat(g);
cout<<"输出每对顶点之间的最短路径:\n";
Floyd(g);
cout<