-
[输入]
图的顶点个数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
-
利用DelphiX for D7开发的桌面小精灵,可以自己在桌面移动,典型的delphix应用。非常经典。...
利用DelphiX for D7开发的桌面小精灵,可以自己在桌面移动,典型的delphix应用。非常经典。-DelphiX use for the development of desktop D7 Little Stars, in their mobile desktop, the typical delphix application. Very classic.
- 2022-05-18 08:15:57下载
- 积分:1
-
cpp primer plus ++ 源码
CPP Primer的源码部分,国外作者贴出来的,可以直接运行,并且分成了章节部分。里面包含详细的说明的README文件和Makefile
- 2023-08-04 19:45:03下载
- 积分:1
-
CSR的单声道耳机MMI调试工具,你可以很容易地创建一个调试功能…
CSR MONO HEADSET MMI调试工具,你可以很轻松的调试出一款功能都合要求的蓝牙耳机-CSR MONO HEADSET MMI debugging tools, you can easily create a debugging features are jointly called for Bluetooth Headset
- 2022-08-07 21:27:54下载
- 积分:1
-
编程一个将字符
串逆转的程序1.当对上面的程序进行了调试后运行会出现下面所示:
第一行所显示的就是Input string is:后面跟着光标等待用户输...
编程一个将字符
串逆转的程序1.当对上面的程序进行了调试后运行会出现下面所示:
第一行所显示的就是Input string is:后面跟着光标等待用户输入字符,输入完成后按回车键,转到下一行,显示The string is:紧跟着刚才输入的字符并逆转输出。第三行显示priess any key to continue -gffdgfdgfdgfdfdsfdfsdf
- 2022-03-20 17:33:43下载
- 积分:1
-
linux下QT编写的小游戏,适用于QT初学者对QT的基本编程的了解
linux下QT编写的小游戏,适用于QT初学者对QT的基本编程的了解-QT under linux written in a small game for QT on the QT for beginners to understand the basic programming
- 2022-12-11 05:30:03下载
- 积分:1
-
prepared by the Huarong Road game, a graphical interface, mouse operation.
用C编写的华荣道游戏,图形界面,用鼠标操作.-prepared by the Huarong Road game, a graphical interface, mouse operation.
- 2022-03-06 18:45:06下载
- 积分:1
-
很好的
VERY GOOD -VERY GOOD!
- 2023-08-28 23:40:04下载
- 积分:1
-
这是一个关于计算机图的一些简单操作的程序,初次作品,谢谢支持...
这是一个关于计算机图的一些简单操作的程序,初次作品,谢谢支持-This is a map on the computer of some simple operating procedures, the initial entries, I would like to thank support
- 2022-07-14 12:42:22下载
- 积分:1
-
一个开发dos程序源代码的平台源代码
一个开发dos程序源代码的平台源代码-a development dos source code platform source code
- 2022-08-19 18:18:54下载
- 积分:1