问题及代码:
*Copyright(c)2016,烟台大学计算机与控制工程学院
*All right reserved.
*文件名称:Floyd算法实现.cpp
*作者:张冰
*时间:11月24日
*版本号;v1.0
*问题描述:
Floyd算法实现
*输入描述:带权图的邻接矩阵
*程序输出:图中所有点之间的路径长度及其具体路径
*/
[cpp] view plain copy
#include <stdio.h>
#include <malloc.h>
#define MAXV 100 //最大顶点个数
#define INF 32767 //INF表示∞
#define MaxSize 100
typedef int InfoType;
//以下定义邻接矩阵类型
typedef struct
{
int no; //顶点编号
InfoType info; //顶点其他信息,在此存放带权图权值
} VertexType; //顶点类型
typedef struct //图的定义
{
int edges[MAXV][MAXV]; //邻接矩阵
int n,e; //顶点数,弧数
VertexType vexs[MAXV]; //存放顶点信息
} MGraph; //图的邻接矩阵类型
//以下定义邻接表类型
typedef struct ANode //弧的结点结构类型
{
int adjvex;