-
[输入]
图的顶点个数N,图中顶点之间的关系及起点A和终点B
[输出]
若A到B无路径,则输出“There is no path” 否则输出A到B路...
[输入]
图的顶点个数N,图中顶点之间的关系及起点A和终点B
[输出]
若A到B无路径,则输出“There is no path” 否则输出A到B路径上个顶点
[存储结构]
图采用邻接矩阵的方式存储。
[算法的基本思想]
采用广度优先搜索的方法,从顶点A开始,依次访问与A邻接的顶点VA1,VA2,...,VAK, 访问遍之后,若没有访问B,则继续访问与VA1邻接的顶点VA11,VA12,...,VA1M,再访问与VA2邻接顶点...,如此下去,直至找到B,最先到达B点的路径,一定是边数最少的路径。实现时采用队列记录被访问过的顶点。每次访问与队头顶点相邻接的顶点,然后将队头顶点从队列中删去。若队空,则说明到不存在通路。在访问顶点过程中,每次把当前顶点的序号作为与其邻接的未访问的顶点的前驱顶点记录下来,以便输出时回溯。
#include
int number //队列类型
typedef struct{
int q[20]
-[imported] map of the number of vertices N, Vertex map of the relationship between the starting point and end point A and B [output] if A to B without path then exporting "There is no path" Otherwise output A to B on the path vertices [storage structure] plan adopted adjacency matrix of storage. [Algorithm for the basic idea] BFS way from the vertex A, A visit followed with adjacent vertices VA1, VA2 ,..., VAK, visiting times, if not visit B, continue to visit with the VA1 adjacent vertices VA11, VA12 ,..., VA1M. VA2 and then
- 2022-01-25 22:50:29下载
- 积分:1
-
personal summing up the basic concepts of documents, allowing beginners to avoid...
个人总结的基本概念文档,可以让初学者避开烦琐的细节,直接进入UML的核心概念。-personal summing up the basic concepts of documents, allowing beginners to avoid tedious details of the UML directly into the core concept.
- 2022-04-11 11:58:13下载
- 积分:1
-
220inverter
220V inverter,using SPWM to driver the supply power is 24V,and with protect about overvoltage,overcurrent
- 2022-10-11 05:15:02下载
- 积分:1
-
shell教学视频,非常适合初学者。希望通过审核!
shell教学视频,非常适合初学者。希望通过审核!-shell teaching video, very suitable for beginners. Hope that through review!
- 2023-05-31 02:00:04下载
- 积分:1
-
Lonworks NodeBuilder错误引导
LonWorks NodeBuilder Errors Guide
- 2022-01-25 15:13:59下载
- 积分:1
-
UG的文件,对学建模大有帮助
UG的文件,对学建模大有帮助-UG documents go a long way in modeling school
- 2022-07-26 22:56:36下载
- 积分:1
-
使用matlab仿真QPSK,包括调制、解调,有详细的源代码,仅供参考...
使用matlab仿真QPSK,包括调制、解调,有详细的源代码,仅供参考-QPSKsimulation
- 2022-03-09 17:00:22下载
- 积分:1
-
仓库管理系统
应用背景相信对于仓库管理的程序大家都不陌生,应用场合也是比较明确的,通过这一程序的编译和使用,可以让学习者更加清晰的掌握C++的数据结构处理,对于这方面感兴趣的朋友可以关注下。关键技术这一管理系统使用的程序处理技术比较标准,对于仓库类的数据分类和记录处理比较模板化,适合于感兴趣的人群,可以以此为基础继续完善深度定制开发,需要个人能够对数据处理较为熟练
- 2022-06-27 10:03:56下载
- 积分:1
-
"pictureRecreator"也是一个很适合java学习者的小游戏,这个游戏将一副大图打散成9张,然后任意挑选8张出来,让玩家通过键盘和鼠标来控制图片移动...
"pictureRecreator"也是一个很适合java学习者的小游戏,这个游戏将一副大图打散成9张,然后任意挑选8张出来,让玩家通过键盘和鼠标来控制图片移动,最后将它复原.-"pictureRecreator" is a very suitable for learners of small java games, the game will be a big map separated into nine, and then a random selection of eight out, allowing the player through the keyboard and mouse to control mobile picture, it will finally recover.
- 2022-03-15 03:45:45下载
- 积分:1
-
一款专业的电话交换机计费管理系统,可适用于任何行业。
一款专业的电话交换机计费管理系统,可适用于任何行业。-A professional telephone exchange billing management system, applicable to any industry.
- 2022-02-12 05:41:00下载
- 积分:1