-
[输入]
图的顶点个数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
-
93317476Synthetic-seismogram-code
几种地震模型的构建,地球物理勘察之类的小伙伴可以用来做一些去噪之类的小程序(The construction of several seismic models, small partners such as geophysical surveys can be used to do small programs such as denoising)
- 2018-04-19 14:01:24下载
- 积分:1
-
TDOA
说明: 用matlab仿真各类TDOA各类定位算法的性能特点(Using MATLAB to simulate the performance characteristics of various kinds of TDOA positioning algorithms)
- 2020-12-29 19:39:00下载
- 积分:1
-
LoraModulation
说明: 一个关于LoRa系统的仿真,包含调制解调,编码,交织部分。(A simulation of Lora system, including modulation and demodulation, coding and interleaving.)
- 2021-02-06 18:09:56下载
- 积分:1
-
2014-03-19-Focuss算法
主要实现源信号盲分离,注释比较清楚,能够运行,对于初学者帮助较大(The main source of blind separation of the signal, the note is relatively clear, able to run, for beginners to help larger)
- 2017-08-05 09:15:37下载
- 积分:1
-
Ping
本程序能快速扫描内网IP,选择IP开始和结束段就可以使用啦,本程序内涵源码,逻辑简单,不需要其它控件,delphi 2010开发(This program can scan intranet IP quickly.)
- 2020-06-21 08:40:02下载
- 积分:1
-
optim
最优化函数集,包括线性规划,非线性规划,带约束优化问题等(Optimization function sets, including linear programming, nonlinear programming, constrained optimization problems, etc)
- 2009-10-02 10:46:04下载
- 积分:1
-
BP评价
说明: pb神经网络评价预测模型,matlab代码编程(kab ankdb dakbd kuba bkubd bukbg vyjv vcj jvhhv vyjvj vyjv vjv bk hukgbku cthc crx hvjy)
- 2020-03-07 18:21:25下载
- 积分:1
-
非常喜欢MSN的消息提示窗口,因此利用两天时间做了这相定时关机的小软件,希望您喜欢!...
非常喜欢MSN的消息提示窗口,因此利用两天时间做了这相定时关机的小软件,希望您喜欢!-Very much like MSN s news prompt window, so use this time to do two days of regular shutdown of small software, hope you like!
- 2022-03-03 03:11:57下载
- 积分:1
-
SIRS
说明: 传染病模型(SIRS)的蒙特卡罗仿真,可以获得与求微分方程数值解相差不大的结果(Monte Carlo simulation of infectious disease model (SIRS))
- 2020-12-21 00:39:10下载
- 积分:1