Add and Remove vertex in Adjacency List representation of Graph

Prerequisites: Linked List, Graph Data Structure

In this article, adding and removing a vertex is discussed in a given adjacency list representation.

Let the Directed Graph be:

The graph can be represented in the Adjacency List representation as:

It is a Linked List representation where the head of the linked list is a vertex in the graph and all the connected nodes are the vertices to which the first vertex is connected. For example, from the graph, it is clear that vertex 0 is connected to vertex 4, 3 and 1. The same is representated in the adjacency list(or Linked List) representation.


Article Tags :
Practice Tags :