/*#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转载请标明出处.