下载此文档

无向图的深度优先遍历.doc


文档分类:IT计算机 | 页数:约3页 举报非法文档有奖
1/3
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/3 下载此文档
文档列表 文档介绍
/*#include<>#include<>#defineMAX_VERTEX_NUM20typedefintInfoType;typedefintVertexType;ode{ intadjvex; ode*nextarc; InfoType*info;}ode;typedefstructVNode{ VertexTypedata; ode*firstarc;}VNode,AdjList[MAX_VERTEX_NUM];typedefstruct{ AdjListvertices; intvexnum,um; intkind;}ALGraph;intvisited[20];voidCreateDG(ALGraph&G){ intk,i; cout<<"请输入结点的个数"<<endl; cin>>; cout<<"请输入边的个数:"<<endl; cin>>; for(i=1;i<=;i++) { [i].data=i; [i].firstarc=NULL; } for(k=1;k<=;k++) { intv1,v2; cout<<"请输入与结点"<<k<<"相邻的边数:"; cin>>v2; cout<<"请输入与第"<<k<<"个结点相连的结点编号:"; cin>>v1; ode*p; p=(ode*)malloc(sizeof(ode)); if(!p)exit(-2); p->adjvex=v1; p->nextarc=NULL; [k].firstarc=p; for(i=1;i<v2;i++) { intm; cout<<"请输入与第"<<k<<"个结点相连的结点编号:"; cin>>m; ode*q; q=(ode*)malloc(sizeof(ode)); if(!p)exit(-2); q->adjvex=m; q->nextarc=NULL; p->nextarc

无向图的深度优先遍历 来自淘豆网www.taodocs.com转载请标明出处.

相关文档 更多>>
非法内容举报中心
文档信息
  • 页数3
  • 收藏数0 收藏
  • 顶次数0
  • 上传人mxh2875
  • 文件大小27 KB
  • 时间2019-03-15
最近更新