Adjacency list representation of graph

<<Previous - Graph Adjacency Matrix

Next - Shortest Path Algorithms >>





Adjacency List Representation

Suppose a graph is sparse, then an adjacency list is the better solution for graph representation. In adjacency list representation, for each vertex, we maintain a list of all adjacent vertices. If the edges have weights, then this extra information is also stored in the list cells. Memory space required for adjacency list is O(|E|+|V|) where E represent the number of edges and V represent the number of vertices.

Adjacency List Representation of Directed Graph



<< Previous - Graph Adjacency Matrix

Next - Shortest Path Algorithms >>










Adjacency list representation of graph

<<Previous - Graph Adjacency Matrix

Next - Shortest Path Algorithms >>





Adjacency List Representation

Suppose a graph is sparse, then an adjacency list is the better solution for graph representation. In adjacency list representation, for each vertex, we maintain a list of all adjacent vertices. If the edges have weights, then this extra information is also stored in the list cells. Memory space required for adjacency list is O(|E|+|V|) where E represent the number of edges and V represent the number of vertices.

Adjacency List Representation of Directed Graph



<< Previous - Graph Adjacency Matrix

Next - Shortest Path Algorithms >>