资源简介
这个是我们做课程设计时做的,感觉是自己做的比较好的一次,所以上传来给大家分享一下,有点献丑了
代码片段和文件信息
#include
#include
#include
#define MAX_VERTEX_NUM 100 /*最大顶点数为100*/
typedef int VertexType;
/*表结点*/
typedef struct ArcNode
{
int adjvex;
int lon;
struct ArcNode * nextarc;
}ArcNode;
/*头结点*/
typedef struct VNode
{
VertexType data;
ArcNode * firstarc;
}VNodeAdjList[MAX_VERTEX_NUM];
typedef struct
{
AdjList vertices;
int vexnumarcnum;
}ALGraph;
//地名
typedef struct Place
{
char name[20];
}PlacePL[20];
int daohang(ALGraph Gint nint qint Lj[20]int M)//导航函数(图,起点,终点,路径数组,范围)
{
ArcNode *s*d*e;
int l=0x;
s=G.vertices[n-1].firstarc;
if(!s) //死路,返回无限远
l=1000;
else
{
Lj[0]=G.vertices[n-1].data;
while(s) //孤立起始点
{
x=s->adjvex;
if(x==q)
{
Lj[1]=q;
l=s->lon;
return l;
}
d=G.vertices[x-1].firstarc;
if(d->adjvex==n)
G.vertices[x-1].firstarc=d->nextarc;
else
{
while(d->nextarc)
{
if(d->nextarc->adjvex==n)
{
d->nextarc=d->nextarc->nextarc;
break;
}
d=d->nextarc;
}
}
s=s->nextarc;
}
int L[20]={0}i=0z;
e=G.vertices[n-1].firstarc;
while(e)
{
if(Mlon)
e=e->nextarc;
else
break;
}
if(e)
{
l=daohang(Ge->adjvexqLM-e->lon)+e->lon;
for(int j=0;j<20;j++)
Lj[j+1]=L[j];
e=e->nextarc;
}
while(e)
{
if(M>=e->lon)
{
if((z=daohang(Ge->adjvexqLM-e->lon)+e->lon) {
l=z;
for(int j=0;j<20;j++)
Lj[j+1]=L[j];
}
}
e=e->nextarc;
}
}
if(l==0)
l=1000;
return l;
}
void get(ALGraph &Gint BC[400])//获得地图(无向图)
{
ArcNode *s;
FILE *fp;
if((fp=fopen(“file““rb“))==NULL)
{
printf(“can not open file\n“);
return ;
}
fread(BC
- 上一篇:端口扫描程序设计详细的报告+源代码.rar
- 下一篇:算法部分背包问题的求解
相关资源
- 国际象棋的qt源代码
- C语言开发实战宝典
- 小甲鱼C语言课件 源代码
- c语言看发的网络协议 ,源代码
- C语言实现的DES对称加密算法
- 数据结构,迷宫问题C语言版源代码
- C语言 学生信息管理系统 源代码
- C语言版3D魔方游戏源代码
- QT5开发及源代码
- USB CAN Tool 源代码(LabVIEW 2011环境)
- 超声波水表源代码
- 一个模糊PID温度控制算法源代码
- 数据结构 图的遍历源代码
- 数据结构实验源代码集
- TCP/IP客户端和服务器端源代码,好用
- 交互式计算机图形学 第六版 OpenGL源代
- 数据结构教程李春葆第五版书中例题
- 三次样条插值类源代码!
- diy写字机grbl v1.1源代码
- C语言常用算法源代码
- 关于LED制作的源代码合集(38套)
-
STM32-ba
se64加密源代码 - 51超声波避障源代码
- 一个C++实现的源代码行数统计工具
- ZZULIOJ部分答案C语言免费.7z
- 吉他调音软件源代码
- 连连看源代码C语言版
- AVR单片机SPI通讯程序 (C语言源代码)
- Visual+C++数字图像处理-谢凤英-源代码
- 大富翁源代码
评论
共有 条评论