#include <iostream>
#include <string.h>
#define Max <1000>
#define inf 32767
#include <malloc.h>
#include <stdlib.h>
using namespace std;
typedef struct ANode
{
int adjvex;
struct ANode *nextarc;
int weight;
}ArcNode;
typedef struct Vnode
{
int data;
ArcNode *firstarc;
}VNode;
typedef struct
{
VNode adjlist[Max];
int n,e;
}AdjGraph;
void createadj(AdjGraph *&G,int A[Max][Max],int n,int e)
{
int i,j;
ArcNode *p;
G=(AdjGraph *)malloc(sizeof(AdjGraph));
for(i=0;i<n;i++)
G->adjlist[i].firstarc=NULL;
for(i=0;i<n;i++)
{
for(j=n-1;j>=0;j--)
if(A[i][j]!=0&&A[i][j]!=inf)
{
p=(ArcNode *)malloc(sizeof(ArcNode));
p->adjvex=j;
p->weight=A[i][j];
p->nextarc=G->adjlist[i].firstarc;
G->adjlist[i].fristarc=p;
}
}
G->n=n;G->e=e;
}
void DispAdj(AdjGraph *G)
{
int i;
ArcNode *p;
for(i=0;i<G->n;i++)
{
p=G->adjlist[i].firstarc;
printf("%3d: ",i);
while(p!=NULL)
{
printf("%3d[%d]->",p->adjvex,p->weight);
p=p->nextarc;
}
printf("^\n");
}
}
int main()
{
return 0;
}