-
[输入]
图的顶点个数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
-
WpfApp1
说明: WPF窗体,靠屏幕右边,便会自动隐藏。鼠标移入窗体滑出。(WPF form, close to the right side of the screen, will be automatically hidden. Move the mouse into the window and slide out.)
- 2020-12-09 13:37:04下载
- 积分:1
-
ISM测向算法
这个是ISM测向算法,适用于宽带信号的测向(This is a test to the ISM algorithm for direction finding of wideband signals)
- 2009-06-10 10:27:05下载
- 积分:1
-
ComQueue
用简单队列的方法实现串口通信,达到数据可以按照一定顺序传输的目的。(Use simple queue of method of serial communication, data can be reached in sequence the purpose of transmission
)
- 2020-07-02 22:40:01下载
- 积分:1
-
Ballend_Cuttingforce
针对钛合金材料和硬质合金刀具,实现球头刀切削力的计算(To calculate the cutting force of ballend cutter when cutting the Ti material with a Carbide cutter)
- 2020-10-31 16:49:55下载
- 积分:1
-
AD7175_Test
测试AD7175,通过串口输出到PC机,100Hz采样速率(Test AD7175, through serial port output to PC machine, 100Hz sampling rate.)
- 2020-12-15 23:49:13下载
- 积分:1
-
栏目地址通过输入网址,相应的源代码。
通过在地址栏中输入Url,可以得到相应的源代码,并提取出网页中的文本信息-column addresses through the importation of Url, the corresponding source code and extract the text of website information
- 2022-09-09 15:55:02下载
- 积分:1
-
冰点
说明: 可以下载所有优惠卷的百度文库的东西,不过注意,不要下载要钱的文本。(You can download all the items in Baidu Library of the discount volume, but note that you should not download the text asking for money)
- 2020-05-19 09:14:17下载
- 积分:1
-
BTRAScan
说明: BTRA automatic gearbox read
- 2020-06-16 23:40:02下载
- 积分:1
-
介绍ar,和dtw两种算法,包含一个实际应用的例子
介绍ar,和dtw两种算法,包含一个实际应用的例子-introduced ar, and two algorithms dtw, including a practical application examples
- 2022-05-26 21:12:02下载
- 积分:1