Directed graph Adjacency sets Adjacency table vertex Set 0123 1,2} 0FTTF 0123 2,3} 1 FTT 2FFFF 0,1,2} 3T TTF
List Implementation of Digraphs typedef int Vertex; template <int max size> class Digraph Iint count; List< Vertex> neighbors[max size } Array Of List
List Implementation of Digraphs typedef int Vertex; template <int max_size> class Digraph { int count; List<Vertex> neighbors[max_size]; }; Array Of List
class Edge; header for the class vertex list of vertices Edge * first_adge Vertex*ne对 Martex; class Edge I Vertex *end_point; Edge *next edge; class Digraph i Vertex*first vertex; 3 next vertex on the linked list
class Edge; class Vertex { Edge *first_edge; Vertex *next_vertex; }; forward declaration start of the adjacency list next vertex on the linked list class Edge { Vertex *end_point; Edge *next_edge; }; vertex to which the edge points next_edge on the adjacency list class Digraph { Vertex *first_vertex; }; header for the list of vertices
vertex o edge(, 1) edge (0, 2) ertex 1 edge(1, 2) edge(1, 3) vertex 2 vertex 3 edge (3, 0) edge (3, 1 edge(3, 2) (a) Linked lists
count= 4 count= 4 vertex adjacency list first edoe 2 23456 3: 5 (b)Contiguous lists (c) Mixed