Problem1427--邻接矩阵存储图的深度优先遍历

1427: 邻接矩阵存储图的深度优先遍历

Time Limit: 1 Sec  Memory Limit: 128 MB
Submit: 0  Solved: 1
[Submit] [Status] [Web Board] [Creator:]

Description

试实现邻接矩阵存储图的深度优先遍历。 函数接口定义: void DFS( MGraph Graph, Vertex V, void (*Visit)(Vertex) ); 其中MGraph是邻接矩阵存储的图,定义如下: typedef struct GNode *PtrToGNode; struct GNode{ int Nv;

Input

图graph,结点S,结点访问标记

Output

图graph,结点S,结点访问标记

Sample Input Copy

5 见图片

Sample Output Copy

DFS from 5: 5 1 3 0 2 4 6

Source/Category