-
[输入]
图的顶点个数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
-
这是自己做的一个FLASH文件,主要显示的是AA大学的图片及其历史...
这是自己做的一个FLASH文件,主要显示的是AA大学的图片及其历史-This is their own to do a FLASH file, mainly shown in the picture is AA University and its history
- 2022-07-07 21:38:47下载
- 积分:1
-
mmstatd包含一个 C库和服务器,用于让应用程序很容易的更新计数器和管理器,以便对它们进行维护。它用内部日志支持事故恢复系统。
mmstatd包含一个 C库和服务器,用于让应用程序很容易的更新计数器和管理器,以便对它们进行维护。它用内部日志支持事故恢复系统。-mmstatd contains a C storehouse and the server, uses in to let
the application procedure very easy renewal counter and the
management, in order to carries on the maintenance to them. It uses
the internal diary support accident to restore the system.
- 2022-05-18 05:28:12下载
- 积分:1
-
21-40example-c代码,是txt文本格式的,另有60例代码会陆续传上来。-21-40example-c code, txt text format. Another 60 cases will successively sent code onto.
- 2022-09-23 20:10:03下载
- 积分:1
-
detailed integrity of the DOS/BIOS interrupts Daquan and English.
详细完整的DOS/BIOS中断功能大全,英文版.-detailed integrity of the DOS/BIOS interrupts Daquan and English.
- 2023-06-02 05:40:03下载
- 积分:1
-
用DFS算法遍历图
用DFS算法遍历图-with DFS traversal algorithm map
- 2022-08-02 22:29:17下载
- 积分:1
-
英文学习资料,关于中国人到美国的生活中收集的平常用到的但学样学不到的日常用语。...
英文学习资料,关于中国人到美国的生活中收集的平常用到的但学样学不到的日常用语。-English learning materials, with regard to Chinese people living in the United States used to collect the usual suit but failed to learn everyday language.
- 2023-08-01 00:15:03下载
- 积分:1
-
伪随机码,运用语音发射,噪声为发射信号,音乐为噪声信号。...
伪随机码,运用语音发射,噪声为发射信号,音乐为噪声信号。-Pseudo-random code, the use of voice-launch, launch signal noise, music for the noise signal.
- 2023-07-26 00:25:02下载
- 积分:1
-
DOS保护模式下汇编程序设计.zip
DOS保护模式下汇编程序设计.zip-DOS protected mode compilation of program design. Zip
- 2022-01-25 17:51:10下载
- 积分:1
-
这是使用PHP编程的虚拟社区MySQL的简易版
这是使用PHP编程的虚拟社区MySQL的简易版-This is the use of PHP Programming Virtual Community simple version of MySQL
- 2022-04-18 11:48:24下载
- 积分:1