Why Matrix Interpretation Needs Care
A graph matrix records information only after its rows and columns have been assigned to vertices. A correct-looking entry can describe the wrong pair of vertices if the ordering is forgotten. Other common errors come from treating powers of the adjacency matrix as though their diagonal entries were always zero, reversing the signs in the Laplacian, or confusing Laplacian nullity with connectedness when a graph has several components.
Throughout, graphs are finite and simple. Choose an ordering \(v_1,\dots,v_n\) of \(V(G)\). The adjacency matrix \(\mathbf A(G)\) has entry \(1\) in position \(i,j\) if \(v_iv_j\in E(G)\), and \(0\) otherwise. The degree matrix \(\mathbf D(G)\) is diagonal, with entry \(\deg(v_i)\) in position \(i,i\). The Laplacian is \(\mathbf L(G)=\mathbf D(G)-\mathbf A(G)\). These matrices are symmetric for undirected graphs.
Vertex Order Is Part of the Calculation
Suppose the original ordering is \(v_1,\dots,v_n\), and a new ordering is \(w_1,\dots,w_n\). Let \(P\) be the permutation matrix whose \(i\)th column is the coordinate vector of \(w_i\) in the original ordering. Then the adjacency and Laplacian matrices in the new ordering are \(P^{\mathsf T}\mathbf A P\) and \(P^{\mathsf T}\mathbf L P\). This simultaneously permutes rows and columns. Permuting just rows, or just columns, does not in general give the matrix of the same undirected graph in a new ordering.
Proof. The matrix \(P\) is invertible and \(P^{-1}=P^{\mathsf T}\). Thus \(P^{\mathsf T}\mathbf A P=P^{-1}\mathbf A P\), which is similar to \(\mathbf A\). Similar matrices have the same characteristic polynomial, because \(\det(xI-P^{-1}\mathbf A P)=\det(P^{-1}(xI-\mathbf A)P)=\det(xI-\mathbf A)\). The same argument applies to \(\mathbf L\). \(\square\)
Worked Example: Reordering a Path
Let \(G\) have \(V(G)=\{1,2,3,4\}\) and \(E(G)=\{12,23,34\}\). In the ordering \((1,2,3,4)\), the adjacency matrix is
Now use the ordering \((3,1,4,2)\). Vertex \(3\) is adjacent to \(1\) and \(4\), but not \(2\), so the first row is \((0,1,1,0)\). Vertex \(1\) is adjacent to \(3\) and \(2\), so the second row is \((1,0,0,1)\). Vertex \(4\) is adjacent only to \(3\), and vertex \(2\) is adjacent to \(1\) and \(3\). Therefore
Check: The \(1\) in position \(1,3\) records the edge \(3\,4\), since those are the first and third vertices in the new ordering. The matrix is symmetric, has zero diagonal, and has six entries equal to \(1\), giving \(6/2=3\) edges, as in the edge set. The changed appearance is due to the changed ordering, not a changed graph.
What the Diagonal of an Adjacency Power Counts
Proof. For \(k=0\), \(\mathbf A^0=I\); its entry \(i,j\) is \(1\) if \(i=j\) and \(0\) otherwise, which counts the length-zero walks. Assume the claim holds for \(k\). By matrix multiplication, \((\mathbf A^{k+1})_{ij}=\sum_{r=1}^n(\mathbf A^k)_{ir}A_{rj}\). A walk of length \(k+1\) from \(v_i\) to \(v_j\) has a unique penultimate vertex \(v_r\). There are \((\mathbf A^k)_{ir}\) walks of length \(k\) to \(v_r\), and \(A_{rj}=1\) exactly when the final step from \(v_r\) to \(v_j\) is an edge. Summing over \(r\) counts each such walk once. This proves the claim by induction. \(\square\)
For a simple graph, \((\mathbf A)_{ii}=0\) because there are no loops. But \((\mathbf A^2)_{ii}=\deg(v_i)\): each length-two closed walk from \(v_i\) goes to one of its neighbors and immediately returns. For higher powers, diagonal entries can count closed walks that travel around cycles, including walks that revisit vertices.
Worked Example: A Nonzero Diagonal in the Third Power
Let \(G\) have \(V(G)=\{1,2,3,4\}\) and \(E(G)=\{12,23,31,34\}\). Its adjacency matrix and square are
The diagonal of \(\mathbf A^2\) is \((2,2,3,1)\), which matches the degrees of vertices \(1,2,3,4\). To find the diagonal of \(\mathbf A^3\), use \((\mathbf A^3)_{ii}=\sum_j A_{ij}(\mathbf A^2)_{ji}\). For vertex \(1\), the neighbors are \(2,3\), giving \(1+1=2\). For vertex \(2\), the neighbors are \(1,3\), giving \(1+1=2\). For vertex \(3\), the neighbors are \(1,2,4\), giving \(1+1+0=2\). For vertex \(4\), the only neighbor is \(3\), giving \(0\). Thus the diagonal is \((2,2,2,0)\).
Check: Vertices \(1,2,3\) lie in the triangle \(1,2,3,1\). From each of them there are two length-three closed walks around that triangle, one in each direction. Vertex \(4\) lies on no triangle, and the computed diagonal entry is \(0\). The graph still has zero diagonal in \(\mathbf A\); it is the third power that records these closed walks.
Laplacian Signs and Disconnected Graphs
Since \(\mathbf L=\mathbf D-\mathbf A\), its diagonal entry at \(v_i\) is \(\deg(v_i)\), and its \(i,j\) entry for distinct vertices is \(-1\) when \(v_iv_j\) is an edge and \(0\) otherwise. In particular, the off-diagonal edge entries are negative, not positive. Each row sums to zero: the diagonal degree is cancelled by one \(-1\) for each neighbor.
Proof. For a vector \(x\) with coordinates \(x_v\), expansion of \(\mathbf L=\mathbf D-\mathbf A\) gives \(x^{\mathsf T}\mathbf Lx=\sum_{uv\in E(G)}(x_u-x_v)^2\). If \(\mathbf Lx=0\), then this sum is \(0\); every term is nonnegative, so \(x_u=x_v\) on every edge. Along paths, \(x\) is therefore constant on each connected component. Conversely, if \(x\) is constant on each component, then at every vertex \(v\), \((\mathbf Lx)_v=\deg(v)x_v-\sum_{u\in N(v)}x_u=0\), including at an isolated vertex where both terms are zero. The nullspace is exactly the set of vectors constant on each component. The indicator vectors of the components form a basis for this space, so its dimension is the number of components. If \(V(G)\) is empty, the space has dimension zero, as asserted. \(\square\)
Worked Example: Correct Laplacian Signs and Nullity
Let \(G\) have \(V(G)=\{1,2,3,4,5\}\) and \(E(G)=\{12,23,31,45\}\). Its components are the triangle on \(\{1,2,3\}\) and the edge on \(\{4,5\}\). The degrees are \(2,2,2,1,1\), so
The two component-indicator vectors are \(x=(1,1,1,0,0)^{\mathsf T}\) and \(y=(0,0,0,1,1)^{\mathsf T}\). Multiplying the displayed matrix by either vector gives the zero vector: in the first three rows for \(x\), each result is \(2-1-1=0\), and in the last two rows for \(y\), each result is \(1-1=0\). The theorem gives nullity \(2\), not \(1\).
Check: Every row of \(\mathbf L\) sums to \(0\), and its diagonal is the degree sequence \(2,2,2,1,1\). Replacing the edge entries \(-1\) by \(+1\) would make, for example, the first row sum \(2+1+1=4\), so the all-ones vector would not be in the nullspace. That sign error contradicts the row-sum check.
Spectral Symmetry and Bipartiteness
The adjacency spectrum is the multiset of eigenvalues of \(\mathbf A(G)\), with each eigenvalue repeated according to its multiplicity. A spectrum is symmetric about \(0\) if every eigenvalue \(\lambda\) occurs as often as \(-\lambda\). A standard result proved earlier is that a bipartite graph has a symmetric adjacency spectrum. The reverse implication also holds; it is unsafe to call spectral symmetry merely a necessary condition.
Proof. Let the eigenvalues, counted with multiplicity, be \(\lambda_1,\dots,\lambda_n\). For every positive odd integer \(k\), symmetry pairs each \(\lambda\) with \(-\lambda\), whose \(k\)th powers sum to zero; any zero eigenvalues also contribute zero. Hence \(\sum_i\lambda_i^k=0\). Since \(\mathbf A\) is real symmetric, its eigenvalues are real and the spectral theorem gives \(\operatorname{tr}(\mathbf A^k)=\sum_i\lambda_i^k=0\).
By the walk-counting theorem, the diagonal entries of \(\mathbf A^k\) count closed walks, so they are nonnegative. If the graph had an odd cycle of length \(k\), traversing that cycle from any of its vertices gives a closed walk of length \(k\). Therefore at least one diagonal entry of \(\mathbf A^k\) would be positive, making its trace positive, a contradiction. Thus the graph has no odd cycle.
For completeness, a graph with no odd cycle is bipartite. In each connected component with at least one vertex, choose a root \(r\), and partition vertices according to whether their distance from \(r\) is even or odd. If an edge joined vertices \(u,v\) of the same parity, shortest paths from \(r\) to \(u\) and \(v\), together with \(uv\), would give an odd closed walk. Every odd closed walk contains an odd cycle: if it repeats a vertex other than its repeated start and end, split it at that repeated vertex into two shorter closed walks; their lengths sum to an odd number, so one is odd, and repetition of this reduction ends at an odd cycle. This contradicts the absence of odd cycles. Hence every edge crosses the parity partition in each component. Combining those partitions gives a bipartition of the whole graph; isolated vertices form singleton components and cause no difficulty. \(\square\)
Worked Example: Reading a Symmetric Spectrum Correctly
Let \(G\) have \(V(G)=\{1,2,3,4\}\) and \(E(G)=\{12,23,34,41\}\), the cycle \(C_4\). Its adjacency matrix is
The vectors \((1,1,1,1)^{\mathsf T}\), \((1,0,-1,0)^{\mathsf T}\), \((0,1,0,-1)^{\mathsf T}\), and \((1,-1,1,-1)^{\mathsf T}\) are eigenvectors. Multiplication by \(\mathbf A\) gives, respectively, \(2\) times the first vector, \(0\) times the second, \(0\) times the third, and \(-2\) times the fourth. These four nonzero vectors are linearly independent, so the eigenvalues with multiplicity are \(2,0,0,-2\). The spectrum is symmetric about \(0\).
The theorem implies that \(G\) is bipartite; directly, the parts are \(\{1,3\}\) and \(\{2,4\}\), and all four listed edges cross between them. The zero eigenvalue has multiplicity two here, but that does not imply that \(G\) has two components: \(C_4\) is connected. It is the nullity of the Laplacian, not the adjacency matrix, that counts components.
Check: Each row of \(\mathbf A\) has two \(1\)s, so multiplying by the all-ones vector gives twice that vector, confirming eigenvalue \(2\). Multiplying by \((1,-1,1,-1)^{\mathsf T}\) gives \((-2,2,-2,2)^{\mathsf T}\), confirming eigenvalue \(-2\). The other two displayed vectors are sent to zero, matching the full list of four eigenvalues.
Practical Checks Before Drawing Conclusions
When a matrix calculation seems to contradict the graph, check the vertex ordering first. Then check the defining formula and compare matrix entries with graph features: adjacency diagonals are zero for simple graphs, row sums of \(\mathbf A\) are degrees, Laplacian diagonals are degrees, and Laplacian row sums are zero. For powers of \(\mathbf A\), interpret entries as walk counts rather than as adjacency indicators. For component questions, use the Laplacian nullity theorem, not the multiplicity of zero as an adjacency eigenvalue.
Finally, distinguish a proved implication from a guess based on a familiar example. Bipartiteness gives spectral symmetry, and spectral symmetry also forces bipartiteness for finite simple undirected graphs. The reverse direction is not an unsupported assumption: the odd-power trace argument proves it. These conclusions rely on the adjacency matrix being real symmetric, as it is for the undirected graphs considered here.
Check Your Understanding
For each question, state the relevant matrix convention or result and show enough working to justify the conclusion.
- For the graph on \(\{a,b,c\}\) with edges \(ab,bc\), write the adjacency matrix in the order \((c,a,b)\). Which entry records the edge \(ab\)?
- Why can \((\mathbf A^2)_{ii}\) be positive even when \(\mathbf A_{ii}=0\)? Interpret it for a vertex of degree \(4\).
- A graph has three connected components, one of which is an isolated vertex. What is the nullity of its Laplacian, and why does the isolated vertex contribute?
- Identify the sign error in a proposed Laplacian whose diagonal entries are degrees and whose off-diagonal entries are \(+1\) at edges. Give a row-sum check.
- Explain why a symmetric adjacency spectrum rules out an odd cycle, using the trace of an odd power of the adjacency matrix.