ConceptComplete

Graph Representations and Matrices

Graph representations bridge combinatorial structures and linear algebra, enabling both efficient algorithms and powerful spectral analysis techniques. The choice of representation significantly impacts computational complexity and analytical capabilities.

DefinitionAdjacency Matrix

For a graph G=(V,E)G = (V, E) with V={v1,,vn}V = \{v_1, \ldots, v_n\}, the adjacency matrix A(G)=[aij]A(G) = [a_{ij}] is the n×nn \times n matrix where: aij={1if {vi,vj}E0otherwisea_{ij} = \begin{cases} 1 & \text{if } \{v_i, v_j\} \in E \\ 0 & \text{otherwise} \end{cases}

For undirected graphs, AA is symmetric. The matrix AkA^k counts walks of length kk: entry (Ak)ij(A^k)_{ij} gives the number of walks from viv_i to vjv_j using exactly kk edges.

The adjacency matrix has time complexity O(n2)O(n^2) for storage and O(1)O(1) for edge existence queries, but O(n2)O(n^2) to iterate over all neighbors. This is inefficient for sparse graphs where mn2m \ll n^2.

DefinitionAdjacency List

An adjacency list representation stores for each vertex vVv \in V a list Adj(v)\text{Adj}(v) of its neighbors. Total space is Θ(n+m)\Theta(n + m), optimal for sparse graphs. Neighbor iteration takes O(deg(v))O(\deg(v)) time, but edge existence queries require O(deg(v))O(\deg(v)).

ExamplePath Graph Representation

For the path P4P_4 with vertices {1,2,3,4}\{1,2,3,4\} and edges {{1,2},{2,3},{3,4}}\{\{1,2\}, \{2,3\}, \{3,4\}\}:

Adjacency matrix: A=(0100101001010010)A = \begin{pmatrix} 0 & 1 & 0 & 0 \\ 1 & 0 & 1 & 0 \\ 0 & 1 & 0 & 1 \\ 0 & 0 & 1 & 0 \end{pmatrix}

Adjacency lists: Adj(1)={2}\text{Adj}(1) = \{2\}, Adj(2)={1,3}\text{Adj}(2) = \{1,3\}, Adj(3)={2,4}\text{Adj}(3) = \{2,4\}, Adj(4)={3}\text{Adj}(4) = \{3\}.

DefinitionIncidence Matrix

The incidence matrix B(G)=[bve]B(G) = [b_{ve}] is an n×mn \times m matrix where: bve={1if vertex v is incident to edge e0otherwiseb_{ve} = \begin{cases} 1 & \text{if vertex } v \text{ is incident to edge } e \\ 0 & \text{otherwise} \end{cases}

For directed graphs, we use bve{1,0,1}b_{ve} \in \{-1, 0, 1\} to indicate edge orientation.

DefinitionLaplacian Matrix

The Laplacian matrix L(G)=DAL(G) = D - A where DD is the diagonal degree matrix with dii=deg(vi)d_{ii} = \deg(v_i). The Laplacian is positive semidefinite with: Lij={deg(vi)if i=j1if {vi,vj}E0otherwiseL_{ij} = \begin{cases} \deg(v_i) & \text{if } i = j \\ -1 & \text{if } \{v_i, v_j\} \in E \\ 0 & \text{otherwise} \end{cases}

Remark

The Laplacian eigenvalues encode deep structural information: the number of zero eigenvalues equals the number of connected components, and the second-smallest eigenvalue (algebraic connectivity) measures how well-connected the graph is. This connection between linear algebra and graph structure is central to spectral graph theory.

Matrix representations enable efficient algorithms (BFS, DFS, shortest paths) and provide tools for spectral analysis, random walks, and graph partitioning. The interplay between combinatorial and algebraic perspectives is a recurring theme in modern graph theory.