p196-4
#define MaxVertexNum 100
typedef char VertexType;
typedef int EdgeType;
typedef struct {
VertexType Vex[MaxVertexNum];
EdgeType Edge[MaxVertexNum][MaxVertexNum];
int vexnum, arcnum;
} MGraph;
typedef struct ArcNode {
int adjvex;
struct ArcNode *next;
} ArcNode;
typedef struct VNode {
VertexType data;
ArcNode *first;
} VNode, AdjList[MaxVertexNum];
typedef struct {
AdjList vertices;
int vexnum, arcnum;
} ALGraph;
void Convert(ALGraph *a, MGraph *m, int n) {
ArcNode *v;
for (int i = 0; i < n; i++) {
v = (a->vertices[i]).first;
while (v) {
m->Edge[i][v->adjvex] = 1;
v = v->next;
}
}
}