Paths of Fixed Length — Squaring the Adjacency Matrix
(Ak)[i][j] counts walks of length exactly k from i to j. Watch binary exponentiation build Ak from A→A²→A⁴→…
step 0
Graph & current power A1
A¹ (length-1 walks)
Read entry (i, j) = number of length-L walks i→j.
row i column j entry (i,j)
Binary exponentiation ladder
Press Step to begin. We compute Ak by repeatedly squaring A and multiplying in the powers whose bit is set in k.
Self-contained visualization. Counting semiring (+,×); entries are exact walk counts (no modulus needed at these sizes).
The diagonal of Ak counts closed walks of length k. See junior.md and professional.md for the proof that each matrix multiply appends one more edge to every walk.