void DFSGraph(AdjList *g,int v0) { ArcNode *s[MAX_VERTEX_NUM]; ArcNode *p; int v; int i; int top = -1; p =(ArcNode *)malloc(sizeof(ArcNode)); visit(g,v0); visited[v0] = TRUE;
top = top +1; Push(&s[top],g -> vertex[v0].firstarc); while(top >= 0){ p = s[top --]; if(p != NULL){ top = top + 1; Push(&s[top],p->nextarc); v = p->adjvex; if(!visited[v]){ visit(g,v); visited[v] = TRUE; top = top +1; Push(&s[top],g->vertex[v].firstarc); } } } printf("\n"); // for(i = 0;i <=) }