登录
首页 » C/C++ » 5

5

于 2019-02-19 发布 文件大小:2KB
0 48
下载积分: 1 下载次数: 0

代码说明:

  1、 创建图类,存储结构使用邻接矩阵。 2、 输入图的节点数n(不超过10个)、边数m,节点分别用1-n代表。 3、 采用“起始节点,终止节点,权值”输入图的m条边,创建图。 4、 输出从节点1开始的BFS遍历,在遍历过程中,如有多个可以选择的节点,则优先选择编号较小的节点。 5、 输出从节点1开始的DFS遍历,在遍历过程中,如有多个可以选择的节点,则优先选择编号较小的节点。 6、 输出从第1节点到第n节点最短路径的长度,如果没有路经,输出0。(1. Create graph class and use adjacency matrix in storage structure. 2. The number of nodes n (no more than 10) and edge m in the input graph are represented by 1-n, respectively. 3. Create a graph by using the m-edges of the input graph of "Starting Node, Terminating Node, Weight Value". 4. Output BFS traversal starting from node 1. In the traversal process, if there are multiple nodes to choose, the node with smaller number will be preferred. 5. Output DFS traversal starting from node 1. In the traversal process, if there are multiple nodes to choose, the node with smaller number will be preferred. 6. Output the length of the shortest path from the first node to the n node. If there is no path, output 0.)

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • 696524资源总数
  • 103920会员总数
  • 65今日下载