⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 routing.h

📁 实现最短路径算法。 实现最短路径算法。
💻 H
字号:
//////////////////////////////////////////////////////////////////
//This file is the interface file of the routing program
//It define the structs and macros used by the program
//Program designer:chaidengfeng
//Zhejiang University,Hangzhou,Zhejiang
//e_mail:chaidf@263.net
//Any question about the program can be asked by sending e_mail to chaidf@263.net
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////

#define DllExport   __declspec( dllexport ) 
#define DllImport   __declspec( dllimport ) 

//constants definition
#define MAXARCNUM            4          //the maximal number of arcs linked to one vertex
#define MAXVETNUM            10000      //the maximal number of vertexs in one graph

#define MAX_N                5          //the maximal number of paths user want to get
#define MAX_LENGTH           2000       //the maximal number of vertexs in one path 

#define MAXNAME              40         //the maximal number of characters of name of arc vertex or road
#define MAXDESCRIPTION       20         //the maximal number of characters of description

#define MAXCOST              999999999  //the maximal cost,it just prevent the program to get the path which cost so much

#define NOVERTEX             -1         //it denote there is no vertex 
#define NOARC                -1         //it denote there is no arc

#define DISTANCE             1          //used to denote distance attribute is requested to compute the cost
#define TIME                 2          //used to denote time attribute is requested to compute the cost

//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
//strusts definition
//////////////////////////////////////////////////////////////////
struct ArcInfo{                    //struct used to describe the information of arc
	int        tailVexNo;          //No. of tail vertex
	char       arcName[MAXNAME];   //arc name
	char       roadName[MAXNAME];  //road name 
	double     distance;           //distance attribute
	double     time;               //time attribute
};

struct VexInfo{
	char       vexName[MAXNAME];   //vertex name
	double     x;                  //x coordinate
	double     y;                  //y coordinate
};

struct ArcNode{
	int        arcNo;              //arc No.
	ArcInfo    info;               //arc information
	ArcNode    *nextArc;           //point to next arc
};

struct VexNode{
	int        vexNo;              //vertex No.
	VexInfo    info;               //vertex infomation
	ArcNode    *firstArc;          //point to first arc linked with this vertex
	VexNode    *nextVex;           //point to next vertex
};

struct PathNode{
	int        vexNo;              //vertex No.
	int        arcNo;              //arc No. this arc link to the next vertex of the next pathNode
	char       vexName[MAXNAME];   //vertex name
	char       arcName[MAXNAME];   //arc name
	char       roadName[MAXNAME];  //road name
	PathNode   *next;              //point to next pathNode
};

struct PathsNode{                  //used to describe the paths founded
	int        pathNo;             //the No. of path
	double     distance;           //distance cost
	double     time;               //time cost
	PathNode   *path;              //point to the path
	PathsNode  *next;              //point to the next paths
};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -