-
[输入]
图的顶点个数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
-
北大青鸟的java学习文档,一共有4份,这是第二份,希望对大家有帮助。...
北大青鸟的java学习文档,一共有4份,这是第二份,希望对大家有帮助。-Beida Jade Bird to learn the java files, a total of 4, which is the second, in the hope that everyone has to help.
- 2022-08-19 02:23:40下载
- 积分:1
-
knockout mice to the game, according to Japanese translation, hope you like, Try...
敲地鼠游戏,根据日文翻译而成,希望大家喜欢,试一下吧-knockout mice to the game, according to Japanese translation, hope you like, Try it
- 2022-08-18 09:10:27下载
- 积分:1
-
FPGA的设计,VHDL编程,Max Plus模拟,在实际电路验证…
FPGA数字钟的设计,用VHDL语言编程,max+plus仿真,可在实际电路中验证-FPGA design, VHDL programming, max plus simulation, in the actual circuit verification
- 2023-01-15 13:10:04下载
- 积分:1
-
为初学者提供MFC程序设计的试验方法和部分知道
为初学者提供MFC程序设计的试验方法和部分知道-MFC for beginners program designed to provide test methods and some know
- 2022-02-12 17:53:36下载
- 积分:1
-
内燃机振动信号的盲分离…
Blind separation of internal combustion engine vibration signals by a deflation method
- 2022-02-27 02:18:07下载
- 积分:1
-
华为的图标库,希望大家能用得上!
我也是需要有一个源码,怎么都下不来!
不知道站长大人能不能发送一份给我
http://www.programsal...
华为的图标库,希望大家能用得上!
我也是需要有一个源码,怎么都下不来!
不知道站长大人能不能发送一份给我
http://www.programsalon.com/downloads44/sourcecode/delphi_control/detail148341.html
对应的代码,很急!谢谢了!-Huawei
- 2022-02-13 01:58:00下载
- 积分:1
-
sdddddsdw
进制转换器,很好用的进制转换器,进制转换器
,进制转换器-sdddddsdw
- 2023-03-17 14:10:03下载
- 积分:1
-
AutoCAD画的三维文件,很不错哦,可以下载后自己参照
AutoCAD画的三维文件,很不错哦,可以下载后自己参照-Three-dimensional AutoCAD drawing files, oh well, you can download their own reference
- 2023-03-05 06:20:03下载
- 积分:1
-
Game name is to eat beans, opened there in detail what kind of play
游戏名是吃豆子,详细打开那里玩什么样的
- 2022-09-19 21:05:03下载
- 积分:1