用C语言和数据结构中的无向图存储结构编一个校园导游图完全的程序代码
#define Infinity 1000
#define MaxVertexNum 35
#define MAX 40
#include
#include
#include
#include
#include
typedef struct arcell //边的权值信息
{
int adj; //权值
}arcell,adjmatrix[MaxVertexNum][MaxVertexNum]; //图的邻接矩阵类型
typedef struct vexsinfo //顶点信息
{
int position; //景点的编号
char name[32]; //景点的名称
char introduction[256]; //景点的介绍
}vexsinfo;
typedef struct mgraph //图结构信息
{
vexsinfo vexs[MaxVertexNum]; //顶点向量(数组)
adjmatrix arcs; //邻接矩阵
int vexnum,arcnum; //分别指定顶点数和边数
}mgraph;
//全局变量
int visited[35]; //用于标志是否已经访问过
int d[35]; //用于存放权值或存储路径顶点编号
mgraph campus; //图变量(大学校园)
// (1) 对图初始化
mgraph initgraph()
{
int i=0,j=0;
mgraph c;
c.vexnum =28; //顶点个数
c.arcnum =39; //边的个数
for(i=0;i
c.vexs[i].position =i;
//依次输入顶点信息
strcpy(c.vexs[0].name ,"小西南门");
strcpy(c.vexs[0].introduction ,"离公交站近");
strcpy(c.vexs[1].name ,"学校南正门");
strcpy(c.vexs[1].introduction ,"学校大门、学校班车进出口");
strcpy(c.vexs[2].name ,"语言文化职业学院");
strcpy(c.vexs[2].introduction ,"语言文化职业学院办公楼,楼高6层");
strcpy(c.vexs[3].name ,"艺术学院");
strcpy(c.vexs[3].introduction ,"音乐系、美术系,楼高4层");
strcpy(c.vexs[4].name ,"行政楼");
strcpy(c.vexs[4].introduction ,"行政办公大楼,楼高5层");
strcpy(c.vexs[5].name,"文学院");
strcpy(c.vexs[5].introduction ,"文学院,楼高6层");
strcpy(c.vexs[6].name ,"体育场");
strcpy(c.vexs[6].introduction ,"室外标准田径场");
strcpy(c.vexs[7].name,"教育科学学院");
strcpy(c.vexs[7].introduction ,"教心系、经管系,楼高5层");
strc