AlgoScope

Adjacency Matrix

A V x V grid where cell (u, v) marks an edge from u to v.

Data structures, data structure, beginner
Edge 0 to 1 sets cells 0, 1 and 1, 0.01234012340100010000000000000000000
Edge 0 to 1 sets cells 0, 1 and 1, 0.01234012340100010000000000000000000

Matrix: Adjacency matrix from edges

Decision, step 2 of 7

Edge 0-1: set (0, 1) and (1, 0) to 1. 1 of 5 edges placed.

How matrix works

Cost

Edge lookup
O(1)
Neighbours
O(V)
Add edge
O(1)
Space
O(V^2)

Leads to

Topics that need this one first.

Taught by the same lesson

Matrix covers these too, in the same run.