Evaluate powers of a square matrix
The connection matrix \(Q\) records the number of direct connections between two vertices. The entry in row 1, column 2 matches the entry in row 2, column 1
\[Q = \begin{bmatrix} 0 & 4 \\ 4 & 0 \end{bmatrix}\]
The entries of \(Q^2\) count two-step routes between the vertices