C語言-資料結構-圖的遍歷
#include <stdlib.h>
#include "ljb.h"
int visited[M];
///圖的遍歷
void dfs(linkedgraph g,int i)
{
edgenode *p;
printf("visit vertex:%c\n",g.adjivex[i].vertex);
visited[i]=1;
p=g.adjlist[i]fristedge;
while(p)
{
if(!visited[p->adjvex])
dfs(g,p->adjvex);
p=p->next;
}
}
void dftraverse(linkedgraph g)
{
int i;
for(i=0;i<g.n;i++)
visited[i]=0;
for(i=0;i<g;i++)
if(!visited)
}
int main()
{
printf("Hello world!\n");
return 0;
}