资源描述:
《全国交通咨询系统设计(c语言)》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、/**建立一个模拟的交通网络(用有向网来表示),编程实现从某个城市*出发到另一个城市所需的最短的时间及路径。**建立一个模拟的交通网络(用有向网来表示),编程实现从某个城市*出发到另一个城市所需的最短的时间及路径。**/#defineMAX_VERTEX_NUM18#defineNULL0#defineMAX_ARC_SIZE100#defineMAX_ROUTE_NUM5#include"stdio.h"#include"stdlib.h"#include"string.h"#defineFalse0#defineTrue1#defineINFINI
2、TY10000/*预定义*/typedefstruct{intnumber;floatexpenditure;intbegintime[2];intarrivetime[2];}Vehide;typedefstruct{Vehidestata[MAX_ROUTE_NUM];intlast;}infolist;typedefstructArcNode{intadjvex;structArcNode*nextarc;infolistinfo;}ArcNode;typedefstructVNode{charcityname[10];ArcNode*plane
3、firstarc,*trainfirstarc;}VNode,AdjList[MAX_VERTEX_NUM];typedefstruct{AdjListvertices;intvexnum,planearcnum,trainarcnum;}ALGraph;typedefstructNode{intadjvex;introute;structNode*next;}Node;typedefstructQNode{intadjvex;structQNode*next;}QNode;typedefstruct{QNode*front;QNode*rear;}L
4、inkQueue;typedefstructTimeNode{intadjvex;introute;intbegintime[2];intarrivetime[2];structTimeNode*child[MAX_ROUTE_NUM];}TimeNode,*TimeTree;structarc{intco;charvt[10];charvh[10];intbt[2];intat[2];floatmo;}a[MAX_ARC_SIZE];/*数据结构定义*/charcity[MAX_VERTEX_NUM][10];intTTime[2];inttime[
5、2];inttime1[2];inttime2[2];intc[MAX_VERTEX_NUM];intd[MAX_VERTEX_NUM];/*变量定义*//*各种操作说明*/voidDisp();voidAdminister(ALGraph*G);voidcityedit(ALGraph*G);voidCopyTimeTree(TimeTreep,TimeTreeq);voidcreatecityfile();voidCreateGraph(ALGraph*G);voidcreateplanefile();voidCreateTimeTree(Time
6、Treep,inti,intj,LinkQueue*Q,infolist(*arcs)[MAX_VERTEX_NUM]);voidcreatetrainfile();intDeleteplaneArc(ALGraph*G);voidDeleteQueue(LinkQueue*Q,int*x);intDeletetrainArc(ALGraph*G);voidDeleteVertex(ALGraph*G);voidDemandDispose(intn,ALGraphG);voidDestoryTimeTree(TimeTreep);voidEnterpl
7、aneArc(ALGraph*G);voidEnterQueue(LinkQueue*Q,intx);voidEntertrainArc(ALGraph*G);voidEnterVertex(ALGraph*G);voidExpenditureDispose(intk,infolist(*arcs)[MAX_VERTEX_NUM],ALGraphG,intv0,intv1,float*M,int*final);voidflightedit(ALGraph*G);voidinitgraph(ALGraph*G);voidInitQueue(LinkQue
8、ue*Q);intIsEmpty(LinkQueue*Q);intLocateVertex(A