Grokking 75: Top Coding Interview Questions
Ask Author
Back to course home

0% completed

Graph Representations
Table of Contents

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Graphs can be represented in multiple ways depending on the use case. The two most common methods are:

  • Adjacency Matrix
  • Adjacency List

Let’s break down both approaches with examples for undirected and directed graphs.

1 Adjacency Matrix

An adjacency matrix is a 2D array (or matrix) used to represent the presence or absence of edges between vertices.

  • The matrix is of size N × N, where N is the number of vertices.
  • Each cell (i, j) indicates whether there’s an edge from vertex i to vertex j.

.....

.....

.....

Like the course? Get enrolled and start learning!

Table of Contents

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible