}
}
}
}
main()
{
int n;
Graph *g=(Graph *)malloc(sizeof(Graph));
char menu;
printf("Please input the number of vertex:\n");
scanf("%d",&n);
creatgraph(g,n);
printf("This is the linjiejuzhen of graph:\n");
printgraph(g);
input:
printf("Please input b or d or q ,Breadth_first: b Depth_first: d quit: q\n"); while((menu=getchar())=='\n');
if(menu=='b')
{
printf("Breadth_first:\n");
BESTraverse(g);
printf("\n");
goto input;
}
else if(menu=='d')
{
printf("Depth_first:\n");
dfstraverse(g);
printf("\n");
goto input;
}
else if(menu=='q')
{
exit(0);
}
else
{
printf("Input error!Please input b or d!\n");
}
}