Adjacency Matrix
A V x V grid where cell (u, v) marks an edge from u to v.
Matrix: Adjacency matrix from edges
Edge 0-1: set (0, 1) and (1, 0) to 1. 1 of 5 edges placed.
Cost
- Edge lookup
- O(1)
- Neighbours
- O(V)
- Add edge
- O(1)
- Space
- O(V^2)
Related
Leads to
Topics that need this one first.
Taught by the same lesson
Matrix covers these too, in the same run.