-
[输入]
图的顶点个数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
-
1维数组
应用背景本代码实现基本的Java编程的任务 ; ; ; ;关键技术Java,阵列,应用,一个层面,一个层面,一个层面,阵列
- 2023-02-28 06:40:03下载
- 积分:1
-
韦根26数据→卡号转换程序
韦根协议是国际上统一的标准,有很多格式,标准的韦根26-bit 应该是最常用的格式。此外,还有34-bit 、37-bit 等格式。此源代码主要用于将韦根26数据转换为卡号数据。
- 2023-06-18 04:35:03下载
- 积分:1
-
一个倒计时的程序
一个倒计时的程序-a countdown procedures
- 2022-02-06 05:21:27下载
- 积分:1
-
source code and annotations are contained in a txt file inside. Cgi on the descr...
源代码和说明都包含在一个txt文件里面.有关cgi的说明和一个可以执行的源程序都在里面.
-source code and annotations are contained in a txt file inside. Cgi on the description and implementation of a source can have on the inside.
- 2022-08-18 22:49:48下载
- 积分:1
-
用C、C++写的学生学藉管理系统,自己写的有课程设计!
用C、C++写的学生学藉管理系统,自己写的有课程设计!-With C, C++ written by students to learn management systems, have written their own curriculum design!
- 2023-05-04 18:35:03下载
- 积分:1
-
实现2ASK,2FSK,2PSK,MSK,GRAY转换自然码
实现2ASK,2FSK,2PSK,MSK,GRAY转换自然码-realise 2ASK,2FSK,2PSK,MSK,GRAY change to natural code。
- 2022-05-22 17:36:32下载
- 积分:1
-
这个程序包里有3个部分:直播服务器,接收端插件,接收端例子。详细内容看文档。...
这个程序包里有3个部分:直播服务器,接收端插件,接收端例子。详细内容看文档。-this procedure bundle of three parts : a live server, plug-in receiver, the receiver example. Detailed contents of files.
- 2023-01-10 20:05:04下载
- 积分:1
-
SD卡资料.rar里边有3个文件,包括SD卡手册,SD卡操作时序图,SD卡CSD寄存器翻译的 中文手册...
SD卡资料.rar里边有3个文件,包括SD卡手册,SD卡操作时序图,SD卡CSD寄存器翻译的 中文手册-SD card. Rar inside has three documents, including SD card manual, SD card operated timing diagram, SD card CSD register of the Chinese translation of the manual
- 2023-07-10 03:35:04下载
- 积分:1
-
采用VB6编制的小小程序,有源代码,无须解压密码,能够将阿拉伯数字转换成汉字...
采用VB6编制的小小程序,有源代码,无须解压密码,能够将阿拉伯数字转换成汉字-use VB6 procedures for the preparation of small, active code without extracting passwords can be converted into Arabic Chinese
- 2023-01-30 16:35:03下载
- 积分:1