-
[输入]
图的顶点个数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
-
Java拼图游戏小程序[功能描述] 这是个类似华容道的拼图游戏,目的是把大的方块移动到窗口的下方。...
Java拼图游戏小程序[功能描述] 这是个类似华容道的拼图游戏,目的是把大的方块移动到窗口的下方。-Java procedures [Description] This is similar to the pieces of the jigsaw HuaRong Road, with the aim of moving large chunks of the window to the bottom.
- 2022-03-19 21:37:55下载
- 积分:1
-
java写的弹球游戏
java写的弹球游戏-the pinball game
- 2023-03-14 04:00:04下载
- 积分:1
-
combobox和checkbox的组合,在下拉框中的选项可以check.
combobox和checkbox的组合,在下拉框中的选项可以check.-combobox and checkbox mix, in the drop-down box options can check.
- 2022-02-02 15:23:50下载
- 积分:1
-
Blogblaster program.It is the software to submit and ping your blog to blog dire...
Blogblaster program.It is the software to submit and ping your blog to blog directories.
- 2022-03-01 06:23:51下载
- 积分:1
-
CString usage of Windows services, including the four major parts: First, Servic...
CString用法
Windows服务包括四大部分:
一,服务控制管理器(Service Control Manager)。是系统中的一个RPC服务器,总管所有服务,“Admin$System32Services.exe”。拥有一个在注册表中记录的数据库,包含了所有已安装的服务程序和设备驱动服务程序的相关信息。
二,服务控制程序(Service Control Program)。用来执行对服务程序的开启、控制和状态查询功能。
三,服务程序(Service Program)。服务的执行代码。
四,服务配置程序(Service Configuration Program)。 用来更改,查询已安装服务的信息。-CString usage of Windows services, including the four major parts: First, Service Control Manager (Service Control Manager). Is an RPC system servers, all mains services,
- 2022-04-24 01:16:09下载
- 积分:1
-
This algorithm used a supervised artificial immune system to achieve the classif...
此算法利用一种有监督的人工免疫系统实现一个图像分类的分类器。-This algorithm used a supervised artificial immune system to achieve the classification of an image classifier.
- 2022-01-25 16:44:50下载
- 积分:1
-
串口通讯程序,负责上位机
串口通讯程序,负责上位机-serial communication program for PC
- 2022-05-19 09:08:05下载
- 积分:1
-
这是一个声控系统,大家可以根据这个软件的代码去做一些相关的软件。其中包括了文档,代码以及软件...
这是一个声控系统,大家可以根据这个软件的代码去做一些相关的软件。其中包括了文档,代码以及软件-This is a voice-activated system, we can according to the software code to do a number of related software. Including documentation, code and software
- 2022-11-10 09:05:04下载
- 积分:1
-
随着自动门ATmega8单片机直流电机控制
DC motor control with atmega8 for auto door
- 2023-03-02 01:05:04下载
- 积分:1