-
[输入]
图的顶点个数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
-
21-40example-c代码,是txt文本格式的,另有60例代码会陆续传上来。-21-40example-c code, txt text format. Another 60 cases will successively sent code onto.
- 2022-09-23 20:10:03下载
- 积分:1
-
DOS下的万年历,有兴趣可改成UNIX下的CAL
DOS下的万年历,有兴趣可改成UNIX下的CAL-calendar under the DOS, UNIX interest may change under the CAL
- 2023-06-18 01:50:03下载
- 积分:1
-
通过分析程序开发
Embedded vc++下开发的路经分析程序-developed under the passing analysis program
- 2022-08-04 08:13:04下载
- 积分:1
-
大一时写的一个人事课设,写的不好,就看看而已
大一时写的一个人事课设,写的不好,就看看而已-large write a lesson based personnel and write well, only to see it
- 2023-04-01 14:25:04下载
- 积分:1
-
一个模块,VB语言的,比较好用,我试过的
一个模块,VB语言的,比较好用,我试过的-A module, VB language, comparative ease of use, I tried the
- 2022-06-19 19:46:56下载
- 积分:1
-
针对飞利浦LPC214x的虚拟串口程序,这个是改进版,比源程序稳定...
针对飞利浦LPC214x的虚拟串口程序,这个是改进版,比源程序稳定-against Philips LPC214x virtual serial port procedures, improved version of this than the source stability
- 2022-05-27 02:15:26下载
- 积分:1
-
可用于IAR EWARM
可以应用到IAR EWARM-EV V5.20
使用方法:
1:首先用iarid.exe产生ID
2:使用iarkg.exe产生lic文件,如:iarkg 0x12345>crack.txt
注意:ID要大写哟。
请支持正版软件,此仅作测试之用。
喜欢就用吧。-Can be applied to IAR EWARM-EV V5.20 Usage: 1: First of all iarid.exe generated using ID2: use iarkg.exe have lic documents, such as: iarkg 0x12345
- 2022-04-15 00:06:23下载
- 积分:1
-
IP地址配置
可以将多个IP地址进行保存,并直接进行切换,可应用在笔记本在公司、家里、其它地方来回换IP的麻烦。
- 2022-12-24 20:00:09下载
- 积分:1
-
financial management systems of finan cial management systems Financial Manageme...
财政管理系统 -financial management systems of finan cial management systems Financial Management System
- 2022-10-31 14:40:03下载
- 积分:1