shortestpath.h

来自「演示了最短路径的算法逻辑」· C头文件 代码 · 共 61 行

H
61
字号
// ShortestPath.h: interface for the ShortestPath class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_SHORTESTPATH_H__3A0B3B6C_CE67_41A5_8586_56BB5093FFC4__INCLUDED_)
#define AFX_SHORTESTPATH_H__3A0B3B6C_CE67_41A5_8586_56BB5093FFC4__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

/*我的预定义*/
#include <string>
#include <iostream>
#include <fstream>
#include <memory>
using namespace std;
#define N 8
#define ARCN 15
#define MAX 10000
/*预定义结束*/

struct PATH
{
	char vex[N];
	int totalweight;

	PATH()
	{
		vex[0] = '\0';
		totalweight = MAX;
	}
};
struct VPosNode
{
	int x,y;
	char data;
};

struct InFo
{
	int x,y,weight;
};

class ShortestPath  
{
	int vexnum , arcnum;
	char vexs[N];	
	PATH path[N][N];
	InFo info[ARCN];
public:
	int arcs[N][N];
	ShortestPath();
	virtual ~ShortestPath();
	void floyd();
	int get_shortpath(char from,char end,string& sshort);
	//bool find_f_e(char from,char end);
};

#endif // !defined(AFX_SHORTESTPATH_H__3A0B3B6C_CE67_41A5_8586_56BB5093FFC4__INCLUDED_)

⌨️ 快捷键说明

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