-
[输入]
图的顶点个数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
-
高山上移动直放站监控系统源代码读取直放的监控盒的源代码...
高山上移动直放站监控系统源代码读取直放的监控盒的源代码-Mountain mobile repeater monitoring system straight release the source code to read the monitor
- 2022-03-17 18:34:40下载
- 积分:1
-
转换汉字到16进制编码和10进制编码的小工具,
java编写,源程序不小心删除了,请反编译即可得到。...
转换汉字到16进制编码和10进制编码的小工具,
java编写,源程序不小心删除了,请反编译即可得到。-Convert Chinese characters to 16 hexadecimal encoding and 10-band encoding gadget, java prepared source accidentally deleted, please decompile can be obtained.
- 2022-07-22 03:16:07下载
- 积分:1
-
工作流模版设计工具,本来是为一个项目配套开发的,
后来因种种原因没有使用。非立项的东西,自然是自己
的了。欢迎共同探讨联。
源代码是Delph...
工作流模版设计工具,本来是为一个项目配套开发的,
后来因种种原因没有使用。非立项的东西,自然是自己
的了。欢迎共同探讨联。
源代码是Delphi实现的,Templet中本来有很多图的,都
删掉,自己尝试画吧
Mail: Hanfi@163.com
MSN gdsoft@msn.com
行水流云-workflow template design tool was originally a project for supporting the development, and later, for various reasons, have not used. Non-establishment of the things that is naturally of their own. Welcome to explore together. Source code is Delphi, which was originally Templet many of the plans are deleted, try to plan it Mail : Hanfi@163.com MSN gdsoft@msn.com flow goes OK
- 2022-05-21 09:38:02下载
- 积分:1
-
数字图像矩阵数据的显示及其傅立叶变换等一些代码及例子
数字图像矩阵数据的显示及其傅立叶变换等一些代码及例子
-Digital image data display matrix and its Fourier transform and some code and examples
- 2022-03-05 10:33:51下载
- 积分:1
-
Information theory, curriculum design in their own code to do run
信息论编码课程设计中自己做到的游程编码的代码,里面包含了哈弗曼的编码算法,希望对你有所帮助。-Information theory, curriculum design in their own code to do run-length coding code, which contains a Havermann encoding algorithm, hope this helps.
- 2023-05-01 00:35:03下载
- 积分:1
-
SET Sensor SIV100B driver debug code
SET Sensor SIV100B驱动调试代码-SET Sensor SIV100B driver debug code
- 2022-05-30 22:59:40下载
- 积分:1
-
红外4PPM解码的源程序,在muxplusII下实现的,
红外4PPM解码的源程序,在muxplusII下实现的,-4PPM infrared source decoder, in the realization of the muxplusII,
- 2023-03-04 01:15:03下载
- 积分:1
-
in DOS environment to support long file name to use
在DOS环境下支持长文件名的使用-in DOS environment to support long file name to use
- 2022-01-25 19:55:29下载
- 积分:1
-
本程序是用vb语言编写的一个游戏,值得学习与参考。
本程序是用vb语言编写的一个游戏,值得学习与参考。-this procedure is used vb language of a game, it is worth learning and reference.
- 2022-03-17 19:43:11下载
- 积分:1