AlgoScope

Adjacency Matrix

Data structurebeginnerGraph Representations

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

Decision · step 2 of 7Matrix: Adjacency matrix from edges
01234012340100010000000000000000000

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

Open in the player →or start at step 2

What you will see

The same graph shown as picture and as grid; hovering an edge highlights its cell.

How matrix works →

Cost

edge lookupO(1)
neighboursO(V)
add edgeO(1)
SpaceO(V^2)

How you work with it here

play it through, step one change at a time, scrub to any step, run it on your own input, try operations in any order.

Screen readers: Each element is an accessibility element with position, value and state; structural changes are announced per step.

Reduced motion: Elements appear at their destination with a crossfade; no travel longer than the element's own size.

Before this

Leads to

Topics that need this one first.

Taught by the same lesson

Matrix covers these too, in the same run.