Worked example 1: Finding Walks using Adjacency Matrices
An undirected graph has $4$ vertices labelled $A$, $B$, $C$, and $D$. Its adjacency matrix $M$ is given by $M = \begin{pmatrix} 0 & 1 & 1 & 0 \\ 1 & 0 & 1 & 1 \\ 1 & 1 & 0 & 1 \\ 0 & 1 & 1 & 0 \end{pmatrix}$. Calculate the exact number of walks of length $3$ between vertex $A$ and vertex $C$.
Solution
1. Identify that the number of walks of length $k$ between vertices in a graph is found by raising its adjacency matrix to the power $k$.
2. Enter the $4 \times 4$ adjacency matrix $M$ into your Graphic Display Calculator.
3. Calculate the matrix power $M^3$ using the GDC matrix workspace.
4. Extract the value located in the 1st row (for vertex $A$) and 3rd column (for vertex $C$) of the resulting matrix.
5. The matrix $M^3$ evaluates to $\begin{pmatrix} 2 & 5 & 5 & 2 \\ 5 & 4 & 5 & 5 \\ 5 & 5 & 4 & 5 \\ 2 & 5 & 5 & 2 \end{pmatrix}$. The exact number of walks is $5$.