Representation of Graphs

Two approaches to represent a graph will be covered in this lesson.

Ways to Represent a Graph

The two most common ways to represent a graph are:

  1. Adjacency Matrix
  2. Adjacency List

Adjacency Matrix

The adjacency matrix is a two-dimensional matrix where each cell can contain a 0 or 1. If a cell contains 1, there exists an edge between the corresponding vertices e.g., Matrix[0 ...

Access this course and 1400+ top-rated courses and projects.