/***************************************************
文件名:路线导航
创建人:张劲暾
创建日期:20171204
****************************************************/
#include <iostream>
#include <cstring>
#include <cstdlib>
#define MapSize 256 //邻接矩阵大小
#define ArcMax 30000 //边权值最大值
#define OK 1
#define ERROR 0
using namespace std;
typedef int Status;
typedef enum{DN,UDN}GraphKind; //DN——有向网,UDN——无向网
typedef struct StackNode{
int num;
StackNode* next;
}StackNode,*Stack;
typedef struct Way{
int last_one;
float dist;
}Way;
typedef struct ArcCell{ //边类型:ArcCell,AdjMatrix[MapSize][MapSize];
float power; //边的权值
}ArcCell,AdjMatrix[MapSize][MapSize];
typedef struct MGraph{ //图类型:MGraph;
char vex[MapSize][25]; //顶点向量
AdjMatrix arcs; //邻接矩阵
int vexnum,arcnum; //边数和顶数
GraphKind kind;
}MGraph;
Status InitStack(Stack &S){
S = (Stack)malloc(sizeof(StackNode));
S->next = NULL;
S->num = -1;
return OK;
}//InitStack
Status Push(Stack &S,int n){
Stack tmp = S,in;
while(tmp->next) tmp = tmp->next;
in = (Stack)malloc(sizeof(StackNode));
in->next = NULL;
in->num = n;
tmp->next = in;
return OK;
}//Push
Status Pop(Stack &S,int &n){
if(S->next ==
基于Dijkstra算法的路径导航
最新推荐文章于 2024-02-03 09:21:28 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)