The adjacency list and the inverse one of the directed graph data ad dest link OA 1∧ dest link B 1B 0+2 2c入 adjacency list (out edge) data adj dest link 0A 1∧ 1 B 0∧ 2C 1∧ Retrorse one( in edge)
The adjacency list and the inverse one of the directed graph A B C data adj A B C 0 1 2 dest link dest link adjacency list (out edge) data adj A B C 0 1 2 dest link Retrorse one(in edge) 1 0 2 0 1 1
Adjacency list of Network 6 data adi dest cost link A 0A 1536∧ 5 2 1 B 2|8∧ B)8 C 2 C 32人 3D 19∧ (vertex list)(adjacency list)
◼ Adjacency list of Network B A C D 6 9 5 2 8 data adj A B C D 0 1 2 3 dest cost link 1 5 3 6 2 8 3 2 1 9 (vertex list) (adjacency list)
Linked list implementation of graph tdefine MAX VERTEX NUM 20 typedef struct ArcNode t int adjvex;//// the vertex which arc point to struct ArcNode nextarc; // point to the next arc 'pointer InfoTvpe info: //the relative information of arc 3 ArcNode; typedef struct VNode i VertexType data; // the vertex'information ArcNode sfirstarc,// point to the first arc which associate the vertex 3 VNode, AdjList[MAX_ VERTEX_ NUM
Linked list implementation of graph #define MAX_VERTEX_NUM 20 typedef struct ArcNode { int adjvex; // // the vertex which arc point to struct ArcNode *nextarc;// point to the next arc ’pointer InfoType *info; //the relative information of arc } ArcNode; typedef struct VNode { VertexType data; // the vertex’ information ArcNode *firstarc; // point to the first arc which associate the vertex } VNode, AdjList[MAX_VERTEX_NUM];
typedef struct i AdiList vertices Int vexnum,arcum; //number of vertex and edge in the graph Int kind; //sign of graph's type JALGraph
typedef struct { AdjList vertices; Int vexnum,arcnum;//number of vertex and edge in the graph Int kind;//sign of graph’s type }ALGraph;
Using adjacency list to define graph typedef char vertexData; //data type of vertex typedef int EdgeData; //weight type of edge typedef struct node i //edge node int dest; /suffix of target vertex EdgeData cost //weight of edge Struct node x link. //pointer of the next eage 3 Edgenode;
typedef char VertexData; //data type of vertex typedef int EdgeData; //weight type of edge typedef struct node { //edge node int dest; //suffix of target vertex EdgeData cost; //weight of edge Struct node * link; //pointer of the next edge } EdgeNode; Using adjacency list to define graph