-
[输入]
图的顶点个数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
-
控制 de 质量
El Inventario Inicial 代表 el 英勇 de las existencias de mercancías en la 和组件 que comenzó el período contable。
Esta 作 se 睁开宽 el 控制 de los inventarios,en el 市长一般,se lleva en 基地 al método especulativo
y 没有 vuelve 柔软运动 hasta finalizar el período contable 宽 se cerrará con 货物 · 克斯克德美洲大道
o bien por Ganancias y Pérdidas directamente。
En la 作经典 se incluyen las mercancías compradas 杜兰特 el período contable con el objeto de volver
venderlas 骗子罚款 de lucro y que forman 单方面 del objeto 段 el cual 综 creada 拉迪尔企业。没有 se incluyen
en esta 作 la compra de 关于、 Maquinarias、 Edificios、 Equipos、 Instalaciones、 等。Esta 作 tiene 联合国 saldo deudor,
- 2022-07-15 11:30:43下载
- 积分:1
-
用c语言编写的利用图形控制寄存器功能写像素函数,其中有定义索引寄存器端口地址和数据寄存器端口地址。...
用c语言编写的利用图形控制寄存器功能写像素函数,其中有定义索引寄存器端口地址和数据寄存器端口地址。-c language used in the preparation of the use of graphics function control registers write pixel function, Index which definition Register port address and data registers port address.
- 2022-02-10 04:31:32下载
- 积分:1
-
对到位地位的的算法排序
对到位地位的的算法排序-place on the status of Sort Algorithm
- 2022-02-09 13:29:51下载
- 积分:1
-
TdxDockSite 问题的解决,不用control atom既可
TdxDockSite 问题的解决,不用control atom既可-TdxDockSite,don t use control atom
- 2022-04-27 17:29:17下载
- 积分:1
-
利用VB制作的一款游戏,很好玩,试试你能打多少分.
利用VB制作的一款游戏,很好玩,试试你能打多少分.-VB produced a game that is a lot of fun, try and shoot you how many points.
- 2022-09-22 04:05:02下载
- 积分:1
-
ads1.2 44b0 RTC读写 RtcAlarm
ads1.2 44b0 RTC读写 RtcAlarm-ads1.2 44b0 RTC read and write RtcAlarm
- 2023-06-08 14:20:03下载
- 积分:1
-
灰色理论原理,对数学建模解决预测问题很有用的ppt,如有不足,希望大家多多改正!...
灰色理论原理,对数学建模解决预测问题很有用的ppt,如有不足,希望大家多多改正!-Gray theory principle of mathematical modeling to solve the issue of prediction useful ppt, is insufficient, I hope everyone a lot to correct!
- 2022-05-20 13:15:56下载
- 积分:1
-
From Microsoft
从微软网站上下的,介绍了公共裤Compact Framework 2.0_OpenNETCF Smart Device Framework 2.0.rar的新增内容,转发给同行--windows mobile开发者-From Microsoft
- 2022-03-07 07:01:37下载
- 积分:1
-
matlab控制器, matlab控制器,下载看看就知道了
matlab控制器, matlab控制器,下载看看就知道了-matlab control system please download
- 2022-01-24 12:30:39下载
- 积分:1