文件名称:tushendu
介绍说明--下载内容均来自于网络,请自行研究使用
图的深度遍历,输出结果为(红色为键盘输入的数据,权值都置为1):
输入顶点数和弧数:8 9
输入8个顶点.
输入顶点0:a
输入顶点1:b
输入顶点2:c
输入顶点3:d
输入顶点4:e
输入顶点5:f
输入顶点6:g
输入顶点7:h
输入9条弧.
输入弧0:a b 1
输入弧1:b d 1
输入弧2:b e 1
输入弧3:d h 1
输入弧4:e h 1
输入弧5:a c 1
输入弧6:c f 1
输入弧7:c g 1
输入弧8:f g 1
深度优先遍历: a b d h e c f g
程序结束.
-Traverse the depth chart, the output results (red for the keyboard input data, weights are set to 1): Enter the number of Vertices and arcs: 8 9 input vertex 8. Input vertex 0: a input vertex 1: b input Vertex 2: c input vertex 3: d input vertex 4: e input vertex 5: f input vertex 6: g Enter the Vertex 7: h input arc 9. input arc 0: ab 1 input arc 1: bd 1 input arc 2: be 1 input arc 3: dh 1 input arc 4: eh 1 input arc 5: ac 1 input arc 6: cf 1 input arc 7: cg 1 input arc 8: fg 1 depth-first traversal: abdhecfg end of the process.
输入顶点数和弧数:8 9
输入8个顶点.
输入顶点0:a
输入顶点1:b
输入顶点2:c
输入顶点3:d
输入顶点4:e
输入顶点5:f
输入顶点6:g
输入顶点7:h
输入9条弧.
输入弧0:a b 1
输入弧1:b d 1
输入弧2:b e 1
输入弧3:d h 1
输入弧4:e h 1
输入弧5:a c 1
输入弧6:c f 1
输入弧7:c g 1
输入弧8:f g 1
深度优先遍历: a b d h e c f g
程序结束.
-Traverse the depth chart, the output results (red for the keyboard input data, weights are set to 1): Enter the number of Vertices and arcs: 8 9 input vertex 8. Input vertex 0: a input vertex 1: b input Vertex 2: c input vertex 3: d input vertex 4: e input vertex 5: f input vertex 6: g Enter the Vertex 7: h input arc 9. input arc 0: ab 1 input arc 1: bd 1 input arc 2: be 1 input arc 3: dh 1 input arc 4: eh 1 input arc 5: ac 1 input arc 6: cf 1 input arc 7: cg 1 input arc 8: fg 1 depth-first traversal: abdhecfg end of the process.
(系统自动生成,下载前可以参看下载内容)
下载文件列表
tushendu.cpp