-
[输入]
图的顶点个数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语言课程设计的源代码,主要似乎初学者使用-c language curriculum design source code, mainly for beginners seem to use
- 2023-04-10 20:40:03下载
- 积分:1
-
gathered with a group and the elimination of noise, the weighing
收集的一组跟噪声产生以及消除、衡量消噪性能指标的MATLAB仿真源代码,每个文件夹下都附有对该代码的注解!-gathered with a group and the elimination of noise, the weighing-noise performance indicators MATLAB simulation source code, Each folder with all of this code notes!
- 2022-01-25 19:48:38下载
- 积分:1
-
This is a delphi mine procedure which is the same of microsoft s.
一个用delphi编的和微软的扫雷一模一样的扫雷程序-This is a delphi mine procedure which is the same of microsoft s.
- 2023-03-11 20:35:03下载
- 积分:1
-
超声波测距电路设计30
超声波测距电路设计+测量距离30-1000cm-Ultrasonic measurement ranging from circuit design+ 30-1000cm
- 2022-04-22 10:20:26下载
- 积分:1
-
IAR EWARM 5.11。凯基和ID。
IAR EWARM 5.11.KEYGEN&ID.
- 2022-02-12 17:05:53下载
- 积分:1
-
Symbian OS下开发的游戏源码,适合S60平台
Symbian OS下开发的游戏源码,适合S60平台-Symbian OS source code to develop the game for S60 platform
- 2022-03-21 01:06:05下载
- 积分:1
-
分机上网 分机上网 分机上网
分机上网 分机上网 分机上网-上网上网ext ext ext ext上网上网上网ext
- 2022-04-08 23:56:59下载
- 积分:1
-
European Installation Bus system USB Serial Interface Driver c source code. Soft...
欧洲安装总线系统的USB串口接口驱动c程序源代码.软件代码由西门子公司提供-European Installation Bus system USB Serial Interface Driver c source code. Software code provided by Siemens
- 2022-07-02 01:24:59下载
- 积分:1
-
RTP 通信开源项目源码
rtp通信开源项目源码,适合任何平台,目前已经基本成熟。按照RFC3550实现,这使得它很容易地发送和接收RTP包和RTCP(RTP控制协议).
- 2022-02-10 14:52:46下载
- 积分:1