Matrix as Graph
Prereq: BFS on Graph
Very often, graph problems are represented as matrices. For example:
A matrix translates to a graph (adjacency list):
Prereq: BFS on Graph
Very often, graph problems are represented as matrices. For example:
A matrix translates to a graph (adjacency list):