graph.h

来自「图的最短路径查询」· C头文件 代码 · 共 45 行

H
45
字号
#include <iostream>
#include <fstream>
#include <string>
#include <conio.h>
#include <dos.h>

using namespace std;

//地名节点
typedef struct
{
	string name;
} vexnode;

//边节点
typedef struct
{
	int weight;
	int price;
	int win;
	int pin;
} edgenode;

//输出路程表节点
typedef struct _outlink
{
	int node;
	struct _outlink* link;
} outlink;

//图对象
class graph
{
private:
	edgenode** edgelist;//保存路径信息
	vexnode* vexlist;//保存地名信息
	int n;//保存地点个数
	bool readdata(string filename);//读取数据文件函数
public:
	graph();
	~graph();
	bool creatgraph(string filename);//路径计算函数
	bool search(string start,string end);//查询函数
};

⌨️ 快捷键说明

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