📄 roufun.~h
字号:
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//This file is the interface file of the routing program
//It declaration the functions in the program and can be used by program designer who want to use these functions
//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
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#include "routing1.h"
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//This is interface function
//It call all the left function to find path between source and destination point
//Parameters:
// vexFile: file name of file that contain vertex information
// arcFile: file name of file that contain arc information
// topoFile: file name of file that contain topo information
// attrFile: file name of file that contain attribute information(distance and time)
// xSou,ySou,xDes,yDes :the coordinate of source and destination point
// pathDis: the minimal distance cost path found
// pathTim: the minimal time cost path found
// N: the number of paths expected to find
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
DllExport bool routing_short(char *vexFile,char *topoFile,char *attrFile,double xSou,double ySou,double xDes,double yDes,PathsNode **pathDis,PathsNode **pathTim,int N);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//This is garph construct function
//It read data from files and construct a graph
//Parameters:
// vexFile: file name of file that contain vertex information
// arcFile: file name of file that contain arc information
// topoFile: file name of file that contain topo information
// attrFile: file name of file that contain attribute information(distance and time)
// graph: the pointer of pointer of graph this function constructed
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool graph_construct(char *vexFile,char *topoFile,char *attrFile,VexNode **graph);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//This is garph construct function
//It destructed a graph and free the memory allocated for it
//Parameters:
// graph: the pointer of graph this function will destructed
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool graph_destruct(VexNode *graph);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//This is Dijkstra function used to get the shortest path between two vertex
//Parameters:
// graph: the pointer of graph this function will use to get path
// souNo: source vertex No.
// desNo: destination vertex No.
// allCost: cost of the path the function find
// kind: parameter used to denote time or distance shortest path is expected to get
// path: the path found
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool graph_Dij(VexNode *graph,int souNo,int desNo,double *allCost,int kind,PathNode **path);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//This is N_shortest paths finder function
//It can be used to get the N_shortest path between two vertex
//Parameters:
// graph: the pointer of graph this function will use to get path
// souNo: source vertex No.
// desNo: destination vertex No.
// allCost: cost of the path the function find
// kind: parameter used to denote time or distance shortest path is expected to get
// pathCost: the path found
// N: the number of paths expected to find
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool graph_Dij_N(VexNode *graph,int souNo,int desNo,int kind,PathsNode **pathCost,int N);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//This is function that set distance and time attributes of graph
//It read data from file and set distance and time attributes of graph
//Parameters:
// attrFile: file name of file that contain attribute information(distance and time)
// graph: the pointer of pointer of graph this function constructed
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool Set_Attr(FILE *attrFp,VexNode **graph);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//This is function that set topo information of graph
//It read data from file and set topo information of graph
//Parameters:
// topoFile: file name of file that contain topo information
// graph: the pointer of pointer of graph this function used
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool Set_Topo(FILE *topoFp,VexNode **graph);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//This is function that set vertex information of graph
//It read data from file and set vertex information of graph
//Parameters:
// vexFile: file name of file that contain vertex information
// graph: the pointer of pointer of graph this function used
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool Set_Vex(FILE *vexFp,VexNode **graph);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//This is function that adjust some struct or complement some information of graph
//Parameters:
// graph: the pointer of pointer of graph this function used
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool complement(VexNode **graph);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//This is path destructed function
//It destructed a path and free the memory allocated for it
//Parameters:
// path: the pointer of path this function will destructed
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
DllExport bool path_destruct(PathsNode *path);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//This is the function that find the nearest vertex to point(x,y)
//Parameters:
// graph: the pointer of graph this function will use
// x: x coordinate of the point
// y: y coordinate of the point
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int get_vexNo(VexNode *graph,double x,double y);
bool create_test(VexNode **graph,char *vexFile,char *topoFile);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -