GIS环境下的最短路径规划算法.docVIP

  • 18
  • 0
  • 约1.06万字
  • 约 10页
  • 2019-09-08 发布于天津
  • 举报
GIS 环境下的最短路径规划算法 ―――此处最短路理解为路径长度最小的路径 02计算机1班 刘继忠 学号:2002374117 整体算法说明: 将图的信息用一个邻接矩阵来表达,通过对邻接矩阵的操作来查找最短路进,最短路径的查找采用迪杰斯特拉算法,根据用户给出的必经结点序列、起点、终点进行分段查找。 各函数功能及函数调用说明。 1).void Welcome() 程序初始化界面,介绍程序的功能、特点及相关提示 2) void CreatGraph(MGraph *G,char buf[]) 把图用邻接矩阵的形式表示,并进行初始化。 3).int ShortestPath(MGraph *G,int jump,int end,int avoid[],int P[MAXSIZE][MAXSIZE],int Dist[],int ShPath[])根据用户给出的起点、终点、必经结点、避开结点进行最短路径的分段查找。 4).void Print(int jump,int end,int Dist[],int ShPath[]) 输出找到的最短路径所经的结点和路径长度。 函数调用循环多次调用Print()CreatGraph()main()Welcome()ShortestPath()图: 循环多次调用 Print() CreatGraph() main() Welcome() ShortestPath() 各函数传入参数及返回值说明: 1).void Welcome() 无传入和返回值 2) void CreatGraph(MGraph *G,char buf[ ]) MGraph *G为主函数中定义的指向存放图的信息的指针变量。 char buf[ ]为主函数中定义的用来存放在图的相关信息录入时的界面信息的数组,以便以后调用查看各结点的信息。 无返回值。 3).int ShortestPath(MGraph *G,int jump,int end,int avoid[],int P[MAXSIZE][MAXSIZE],int Dist[ ],int ShPath[ ]) MGraph *G指向存放图的信息的指针变量。 int jump起点,int end终点,int avoid[ ] 避开结点序列。 int P[MAXSIZE][MAXSIZE] 用来记录各点当前找到的最短路径所经过的结点。 int Dist[ ] 记录各结点的当前找到的最短路径的长度。 int ShPath[ ] 用来存放用户需要的最短路径所经的各结点。 返回最短路径查找是否成功的信息。(return SUCCEED; return ERROR) 4).void Print(int jump,int end,int Dist[],int ShPath[]) int jump起点,int end终点。 int Dist[ ] 记录各结点的当前找到的最短路径的长度。 int ShPath[ ] 用来存放用户需要的最短路径所经的各结点。 无返回值。 4.用户说明: ① 源程序经编译连接后运行,出现程序的初始化界面,其内容为介绍程序的功能、特点及相关提示。如下: Welcome to shortest path searching system. Instructions Function: 1. Personal travelling route choosing. 2. Assistan helper in citys traffic design. 3. Shortes path choose in the comlicated traffic net of the city. Characteristic: It is convient,you could set vital point you must travel,and the point you must avoid. Prompt: If the condition is too secret ,maybe there will have no path available. Designer: Liu jizhong. Complate-data: 2004. 3. 21 CopyRight: Shared program,welcome to improve it. Press anykey to enter the program... ② 按任意键进入图

文档评论(0)

1亿VIP精品文档

相关文档