#include <stdio.h>
typedef int Status;
#define OK 1
#define ERROR 0
#define MaxInt 32767 //表示极大值,即∞
#define MVNum 100
#define false -1
#define true 0 //最大顶点数
typedef char VerTexType; //顶点的数据类型为字符型
typedef int ArcType; //边的权值类型为整型
typedef struct{
//****
VerTexType vexs[MVNum];//顶点的信息
ArcType arcs[MVNum][MVNum];
int vexnum,arcnum,min ;
}AMGraph;
int LocateVex(AMGraph &G,VerTexType v)
{
//****
/* 初始条件: 图G存在,v和G中顶点有相同特征*/
/* 操作结果: 若G中存在顶点u,则返回该顶点在图中位置;否则返回-1 */
for(int i=0;i<G.vexnum;i++)
{
if(v==G.vexs[i])
return i;
else return -1;
}
}
Status CreateUDN(AMGraph &G) //采用邻接矩阵表示法,创建无向图G
{
int i, j,k;
VerTex