-
[输入]
图的顶点个数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
-
clock
说明: there's a clock divider for DE2 altra board clock (50MHz)
- 2017-07-29 23:46:29下载
- 积分:1
-
eluosifangkuai
这是一款基于C#语言的模拟俄罗斯方块的源码,游戏背景及关卡都可以自己设置(This is a simulation language based on C# source code for Tetris, the game background and can set up their own checkpoints)
- 2011-05-29 00:43:49下载
- 积分:1
-
我所学习过的C++代码大全
说明: 常用的C++代码,包含C++的基础功能和高级功能,方便查阅。(Commonly used C++ code, including the basic functions and advanced functions of C++ for easy access.)
- 2020-06-25 12:40:02下载
- 积分:1
-
Sim_EKB_Install_2016_07_16
说明: 西门子注册软件Sim_EKB_Install_2016_07_16(siemens Sim_EKB_Install_2016_07_16)
- 2020-06-15 22:30:01下载
- 积分:1
-
推箱子游戏,游戏规则详见源代码注释部分,全C语言编程
推箱子游戏,游戏规则详见源代码注释部分,全C语言编程-Tuixiangzi game, the rules of the game as detailed source notes, the entire C language programming
- 2023-04-16 06:30:03下载
- 积分:1
-
fem-in-shuilihuanjing
是一个基于有限元来模拟和预测水利环境容量的资料(Is based on the finite element to simulate and forecast information on water environmental capacity)
- 2011-04-23 20:41:44下载
- 积分:1
-
ws2811b
ws2811b彩灯驱动,未测试,未测试。(Ws2811b color light drive, untested, untested.)
- 2019-05-07 12:03:19下载
- 积分:1
-
jisuanqi
课程设计,用C语言编写的计算器程序,经调试成功运行,值得参考(Curriculum design, with a calculator program written in C, after a successful commissioning run, worthy of reference)
- 2011-07-23 14:38:05下载
- 积分:1
-
xjcadzhq_43362
说明: cda的破解,可以使用此,随意转换pdf,dmg工程图为图片(cda,reversefor the moment to this)
- 2020-06-17 06:20:02下载
- 积分:1