数据结构采邻接矩阵构造无向网G.docVIP

  • 5
  • 0
  • 约2.04千字
  • 约 5页
  • 2016-12-02 发布于贵州
  • 举报
数据结构采邻接矩阵构造无向网G

实验目的 采用数组(邻接矩阵)表示法,构造无向网G 实验内容 编程序并上机调试运行。 采用数组(邻接矩阵)表示法,构造无向网G 编写程序 //采用邻接矩阵表示法,构造无向网G #define MAX_VERTEX_NUM 20 //最大顶点个数 #includestdio.h //typedef enum {DG,DN,UDG,UDN} Graphkind; typedef struct ArcCell{ int adj; // int *info; }ArcCell,AdjMatrix[MAX_VERTEX_NUM][MAX_VERTEX_NUM]; typedef struct { int vexs[MAX_VERTEX_NUM]; AdjMatrix arcs; int vexnum,arcnum; //GraphKind kind; }MGraph; int CreateUDN(MGraph G){ int i,j,k,v1,v2,w; printf(请输入顶点数和边数(中间用逗号隔开):\n); scanf(%d,%d,G.vexnum ,G.arcnum ); for(i=0;iG.vexnum ;i++) {printf(请输入顶点信息:); scanf(%d,G.vexs[i]); getcha

文档评论(0)

1亿VIP精品文档

相关文档