Matrix multiplication and walks

Each entry of a matrix product as a row-times-column sum, and the entries of A² as counts of two-step walks in a directed graph.

Figure 1.6.Click a cell of A × B to expand its sum. In the second part, click a cell of A² to highlight the two-step walks it counts. Open on its own

Entry (i, j) of A² is the sum over k of A[i][k] · A[k][j]: one term for each middle vertex k with arrows i → k and k → j.