#include <iostream>
using namespace std;
const int inf = 99999999;
int arr[100][100];
typedef struct ArcNode{
int adjvex;
int weight;
ArcNode *next;
}ArcNode;
typedef struct VertexNode{
int vertex;
ArcNode *firstarc;
}VertexNode,AdjList[100];
typedef struct GraphAdjList{
AdjList adjlist;
int vexnum;
int arcnum;
}GraphAdjList;
void graphArrToList(GraphAdjList &G){
G.vexnum = n;
G.arcnum = m;
for(int i = 0; i < G.vexnum; i++){
G.adjlist[i].vertex = i;
G.adjlist[i].first = NULL;
}
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++){
if(arr[i]][j] != inf && arr[i]][j] != 0){
ArcNode *p;
p->adjvex = j;
p->weight = arr[i][j];
p->next = G.adjlist[i].firstarc; //頭插法
G.adjlist[i].firstarc = p;
}
}
}
}
int main(){
GraphAdjList G;
createGraphAdjList(G);
printfGraphAdjList(G);
createGraphAdjArr(G);
printfGraphAdjArr(G.vexnum);
}