Walk count from powers of an adjacency matrix (source code)

= Walk count from powers of an adjacency matrix

For every nonnegative integer $k$, the entry $(A^k)_{uv}$ equals the number of length-$k$ walks from $u$ to $v$. This follows by induction, since matrix multiplication appends one adjacent vertex to each walk.