-
[输入]
图的顶点个数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
-
可生成C语言代码流程结构的软件.
如需使用说明,可上网查找相关资料.
此软件是好评度较高的看代码软件...
可生成C语言代码流程结构的软件.
如需使用说明,可上网查找相关资料.
此软件是好评度较高的看代码软件-Can generate C language code of the software process structure. For usage instructions available online to find relevant information. This software is high praise view source software
- 2022-07-02 05:39:19下载
- 积分:1
-
arm9 development
is extremely important for arm9 development board.
arm9 development
is extremely important for arm9 development board.
- 2022-01-28 04:34:05下载
- 积分:1
-
试着用这个来进行计时。
Try this for stopwatch counter timer.
- 2023-09-04 14:10:03下载
- 积分:1
-
石子归并问题:在一个圆形操场的四周摆放着N堆石子(N<= 100),现要将石子有次序地合并成一堆.规定每次只能选取相邻的两堆合并成新的一堆,并将新的一堆的...
石子归并问题:在一个圆形操场的四周摆放着N堆石子(N
- 2023-05-17 22:10:02下载
- 积分:1
-
A simple and easy to see to understand all of the frequency counter design progr...
一个简单大家容易看的懂的频率计设计程序,可以实现自动换挡功能。-A simple and easy to see to understand all of the frequency counter design program that can automatically shift feature.
- 2023-03-04 06:25:03下载
- 积分:1
-
土木工程中无应力时长度计算程序,可按内容适当作修改再应用于不同的地方...
土木工程中无应力时长度计算程序,可按内容适当作修改再应用于不同的地方-civil engineering at length without stress calculation procedures can be revised as appropriate then applied to different places
- 2023-08-11 10:20:03下载
- 积分:1
-
Anthill是一个确保受控建造过程和促进在组织内部共享知识的工具。Anthill在每一次建造之前从项目最新版本的源文件库中借出文件,并在每一次建造之后用一个唯
Anthill是一个确保受控建造过程和促进在组织内部共享知识的工具。Anthill在每一次建造之前从项目最新版本的源文件库中借出文件,并在每一次建造之后用一个唯一的版本号标记源文件库。它支持的库适配器有:CVS (Concurrent Versions System), Visual Source Safe, Perforce, PVCS, StarTeam, MKSIntegrity, 和 FileSystem. 来源:http://freshmeat.net/projects/ant8/?topic_id=45%2C822%2C52%2C46%2C861 -Anthill is guarantees is controlled the construction process and
the promotion in the organization interior sharing knowledge tool.
Anthill before each construction loans the document from in the
project newest edition source document storehouse, and after each
construction marks the source document storehouse with an only edition
number. It supports the storehouse adapter includes: CVS (Concurrent
Versions System), Visual Source Safe, Perforce, PVCS, StarTeam,
MKSIntegrity, with FileSystem. origin:
Http://freshmeat.net/projects/ant8/? Topic_id=45,822,52,46,861
- 2022-01-27 11:39:50下载
- 积分:1
-
用matlab编写的雷达系统信号仿真程序,包含雷达个部分的仿真程序...
用matlab编写的雷达系统信号仿真程序,包含雷达个部分的仿真程序
- 2023-07-29 03:05:03下载
- 积分:1
-
设计模式中单件类的例子,用VC++开发,有源码和可执行程序,直接编译运行。是根据李建忠的设计模式讲义编写的例子,对初学设计模式的人很有帮助。...
设计模式中单件类的例子,用VC++开发,有源码和可执行程序,直接编译运行。是根据李建忠的设计模式讲义编写的例子,对初学设计模式的人很有帮助。-Design Patterns in a single category of examples, using VC++ development, there is source code and executable programs, run the compiler directly. LI Jian-zhong design is based on notes prepared by the example model of learning design patterns were very helpful.
- 2022-10-18 17:35:03下载
- 积分:1