Introduction to
Adjacency List

Introduction to Adjacency List
An array of Lists is used to store edges between two vertices. The size of array is equal to the number of vertices (i.e, n). Each index in this array represents a specific vertex in the graph. The entry at the index i of the array contains a linked list containing the vertices that are adjacent to vertex i.

Construction:
Let’s assume there are n vertices in the graph So, create an array of list of size n as adjList[n].
adjList[0] will have all the nodes which are connected to vertex 0.
adjList[1] will have all the nodes which are connected to vertex 1 and so on.
Advantages of Adjacency list:
1. An adjacency list is simple and easy to understand.
2.Adding or removing edges from a graph is quick and easy.
Disadvantages of Adjacency list:
1. An adjacency list is simple and easy to understand.
2.Adding or removing edges from a graph is quick and easy.