-
[输入]
图的顶点个数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
-
Delphi VCL
OS Develop
Delphi VCL
OS Develop
- 2023-08-13 07:05:04下载
- 积分:1
-
一些初级的基本磁盘操作系统的知识,但没用,计算机网络系统…
DOS的一些初级知识,别看没用了,计算机组网课装系统时可能会学一下,总之了解了解:)- Some of the primary BDOS knowledge, though useless, the computer system network loaded class may learn about, know know a word:)
- 2022-01-25 22:48:47下载
- 积分:1
-
algorithm List of Viterbi algorithm, use qpsk channel, the coding is used (133,1...
这是lva算法,List of viterbi algorithm,使用qpsk信道,采用的编码是(133,171,165)-algorithm List of Viterbi algorithm, use qpsk channel, the coding is used (133,171,165)
- 2023-05-29 09:15:03下载
- 积分:1
-
这是我闲时无聊写的小游戏,完整的win32 GDI游戏教学。对新手很有用。包括游戏和地图编辑器。还有已经制作好的8个关卡地图文件。...
这是我闲时无聊写的小游戏,完整的win32 GDI游戏教学。对新手很有用。包括游戏和地图编辑器。还有已经制作好的8个关卡地图文件。-This is my leisure to write silly little games, complete games win32 GDI teaching. Useful for the novice. Including games and map editor. There has produced a good 8 points map document.
- 2023-02-03 08:15:04下载
- 积分:1
-
测试C语言子模块运行速度的C语言源程序
测试C语言子模块运行速度的C语言源程序-test C language module operating speed of C language source
- 2023-03-14 18:45:04下载
- 积分:1
-
盲源分离的非线性创新
Nonlinear innovation to blind source separation
- 2022-07-21 06:42:25下载
- 积分:1
-
利用visual C++对输入的两个数字进行加减乘除运算
利用visual C++对输入的两个数字进行加减乘除运算-The use of visual C++ right input add or subtract two numbers multiplication and division operations
- 2023-07-17 02:50:02下载
- 积分:1
-
这是一种心灵的java开发
这是一个JAVA开发的心型线程序。-This is a JAVA development of the heart-shaped line procedures.
- 2022-05-21 04:01:08下载
- 积分:1
-
这是php编的论坛的原代码,希望正在学习php的同行借鉴一下,我们学校的论坛原代码就是这个 !...
这是php编的论坛的原代码,希望正在学习php的同行借鉴一下,我们学校的论坛原代码就是这个 !-This is php series of the Forum of the original code, php hope is learning from peers, we are a forum for schools is the original code!
- 2022-11-02 09:10:03下载
- 积分:1