#include<iostream>
#include<iomanip>
#define MAX_VERTEX_NUM 20
typedef char VertexType;
using namespace std;
typedef struct ArcNode
{
int adjvex;
struct ArcNode *nextarc;
}ArcNode;
typedef struct VNode
{
VertexType data;
ArcNode *firstarc;
}VNode,AdjList[MAX_VERTEX_NUM];
typedef struct
{
AdjList vertices;
int vexnum,arcnum;
}ALGraph;
int LocateVex(ALGraph G,VertexType v) //返回顶点v在图G中的位置
{
int i;
for(i=0;v!=G.vertices[i].data;i++);
return i;
}
void CreateALGraph(ALGraph &G)
{
//创建图的邻接表存储
int i,j,k;
本内容试读结束,登录后可阅读更多
下载后可阅读完整内容,剩余2页未读,立即下载