#include #include typedef int InfoType; #define MAXV 100 /*最大顶点个数*/ /*以下定义邻接矩阵类型*/ typedef struct { int no; /*顶点编号*/ InfoType info; /*顶点其他信息*/ } VertexType; /*顶点类型*/ typedef struct /*图的定义*/ { int edges[MAXV][MAXV]; /*邻接矩阵*/ int vexnum,arcnum; /*顶点数,弧数*/ VertexType vexs[MAXV]; /*存放顶点信息*/ } MGraph; /*图的邻接矩阵类型*/ /*以下定义邻接表类型*/ typedef struct ANode /*弧的结点结构类型*/ { int adjvex; /*该弧的终点位置*/ struct ANode *nextarc; /*指向下一条弧的指针*/ InfoType info; /*该弧的相关信息,这里用于存放权值*/ } ArcNode;
1