#include
#define INFINITY 10000//最大数
using namespacestd;const int maxEdges=50;const int maxVertices=100; //最大顶点数
structPathWay{double dist;//权值
};classMyGraph
{private:int vNum;//当前顶点数
int eNum;//当前边数
char Vertex[maxVertices];//顶点数组
PathWay Edge[maxVertices][maxVertices];//边数组
public:void Create(int size = maxEdges);//构造函数
bool FindVertex(intvertex);bool InsertVertex(int vertex);//插入一个顶点vertex
bool InsertEdge(const int v1,const int v2,const int weight);//插入一条边(v1,v2),该边上的权值为weight
bool GetVertexPos(const int &vertex,int &i);//给出顶点vertex在图中的位置
void Floyd();//Floyd算法
void Print();//输出邻接矩阵
void short_compare(double farthest[]);//求出最短路径
double far_compare(double shortest[]);//这个问题的答案,在short_compare函数中选出一个最小的值
};void MyGraph::Create(int size)//将图转化成邻接矩阵保存
{int n,e;//n是村庄