Comprehensive Guide to Adjacency Matrices in Graph Theory
Understanding the Concept and Formation of Adjacency Matrices
Fundamentals of Adjacency Matrices
An adjacency matrix is a square matrix used to represent a finite graph by indicating which vertices (or nodes) are connected by edges. Each element in the matrix corresponds to a pair of vertices, showing whether they share a direct connection. This matrix provides a compact and systematic way to describe the structure of a graph, where rows and columns represent vertices, and entries indicate adjacency.
In graph theory, vertices are the fundamental units (nodes), and edges are the connections between these vertices. The adjacency matrix captures this relationship numerically, typically using 0s and 1s to denote absence or presence of edges respectively.
Step-by-Step Construction of an Adjacency Matrix
To build an adjacency matrix for a graph with \( n \) vertices, create an \( n \times n \) matrix where the entry at row \( i \) and column \( j \), denoted \( a_{ij} \), represents the number of edges from vertex \( v_i \) to vertex \( v_j \). For undirected graphs, the matrix is symmetric, meaning \( a_{ij} = a_{ji} \) for all \( i, j \).
Formally, for a graph \( G \) with vertex set \( \{v_1, v_2, \ldots, v_n\} \), the adjacency matrix \( A \) is defined as:
\[ a_{ij} = \begin{cases} 1 & \text{if there is an edge from } v_i \text{ to } v_j, \\ 0 & \text{otherwise}. \end{cases} \]
In the case of graphs without self-loops, the diagonal entries \( a_{ii} \) are zero. The adjacency matrix is also called the connection matrix or vertex matrix.
Illustration of Adjacency Matrix from a Directed Graph

Example of a directed graph used to form an adjacency matrix
Example Problem
Given a directed graph with 4 vertices where edges exist from vertex 1 to 2, vertex 2 to 3, and vertex 3 to 4, construct the adjacency matrix.
Solution:
Label the vertices as \( v_1, v_2, v_3, v_4 \). The adjacency matrix \( A \) is a \( 4 \times 4 \) matrix where:
\[ A = \begin{bmatrix} 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 0 & 0 \end{bmatrix} \]
Here, each 1 indicates a directed edge from the row vertex to the column vertex.
Key Characteristics and Mathematical Properties of Adjacency Matrices
Matrix Powers and Path Counting
One powerful feature of adjacency matrices is their ability to reveal information about paths in a graph through matrix multiplication. Specifically, the \( n \)-th power of the adjacency matrix, \( A^n \), encodes the number of distinct walks of length \( n \) between vertices.
The following theorem formalizes this:
Theorem: If \( A \) is the adjacency matrix of a graph, then the entry \( (i,j) \) of \( A^n \) equals the number of walks of length \( n \) from vertex \( v_i \) to vertex \( v_j \).
Spectral Properties and Regular Graphs
Eigenvalues of adjacency matrices are studied in spectral graph theory. For a \( k \)-regular graph (where each vertex has degree \( k \)), the adjacency matrix \( A \) satisfies the relation \( A \mathbf{v} = k \mathbf{v} \), where \( \mathbf{v} \) is the all-ones vector. This means each row sums to \( k \), reflecting the uniform degree of vertices.
Graph Isomorphism and Matrix Similarity
Two graphs are isomorphic if one can be transformed into the other by relabeling vertices. Although isomorphic graphs may have different adjacency matrices due to vertex labeling, their matrices are related by a permutation similarity:
Theorem: Graphs \( G \) and \( H \) with adjacency matrices \( A \) and \( B \) are isomorphic if and only if there exists a permutation matrix \( P \) such that:
\[ B = P A P^{-1} \]
Example Problem
Consider two graphs with adjacency matrices \( A \) and \( B \). If \( B = P A P^{-1} \) for some permutation matrix \( P \), explain what this implies about the graphs.
Solution:
This relation means the graphs are isomorphic, differing only by vertex labeling.
The permutation matrix \( P \) reorders vertices to match the structure of the other graph.
Thus, the graphs have identical connectivity despite different adjacency matrices.
Adjacency Matrices for Undirected and Directed Graphs with Examples
Adjacency Matrix Representation of Undirected Graphs
In undirected graphs, edges have no direction, so the adjacency matrix is symmetric. Each edge contributes 1 to two symmetric positions \( (i,j) \) and \( (j,i) \). Loops (edges from a vertex to itself) add 2 to the diagonal entry.
The degree of a vertex can be found by summing the values in its corresponding row or column.

An undirected graph illustrating adjacency matrix construction
The adjacency matrix for this graph is:
\[ A = \begin{bmatrix} 0 & 1 & 1 & 0 & 0 & 0 \\ 1 & 0 & 1 & 0 & 1 & 1 \\ 1 & 1 & 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 & 1 & 0 \\ 0 & 1 & 0 & 1 & 0 & 1 \\ 0 & 1 & 0 & 0 & 1 & 0 \end{bmatrix} \]
Adjacency Matrix for Directed Graphs
Directed graphs have edges with specific directions. The adjacency matrix is generally not symmetric, as \( a_{ij} \) indicates an edge from vertex \( v_i \) to vertex \( v_j \), which may not imply an edge from \( v_j \) to \( v_i \).

Directed graph example showing adjacency matrix structure
Practical Example: Constructing an Adjacency Matrix for a Weighted Undirected Graph
Consider the following weighted undirected graph:

Weighted undirected graph for adjacency matrix example
Example Problem
Write the adjacency matrix representing the weights of the edges in the above graph.
Solution:
The adjacency matrix \( A \) is symmetric, with entries representing the weights of edges between vertices. If no edge exists, the entry is 0.
\[ A = \begin{bmatrix} 0 & 4 & 0 & 0 & 0 \\ 4 & 0 & 3 & 0 & 0 \\ 0 & 3 & 0 & 2 & 0 \\ 0 & 0 & 2 & 0 & 5 \\ 0 & 0 & 0 & 5 & 0 \end{bmatrix} \]
Quick Reference: Summary of Adjacency Matrix Concepts
Aspect | Description | Key Property |
|---|---|---|
Definition | Square matrix representing vertex adjacency in a graph | Entries are 0 or 1 (or weights) |
Size | \( n \times n \) for a graph with \( n \) vertices | Diagonal entries zero if no self-loops |
Undirected Graph | Symmetric adjacency matrix | \( a_{ij} = a_{ji} \) |
Directed Graph | Asymmetric matrix showing edge directions | \( a_{ij} \neq a_{ji} \) in general |
Matrix Powers | \( A^n \) counts walks of length \( n \) | Entry \( (i,j) \) = number of \( n \)-step walks |
Graph Isomorphism | Permutation similarity of adjacency matrices | \( B = P A P^{-1} \) for permutation matrix \( P \) |
Weighted Graphs | Entries represent edge weights | Matrix is symmetric if undirected |
Degree of Vertex | Sum of row or column entries in undirected graphs | Counts number of edges incident to vertex |
Self-loops | Edges from vertex to itself | Diagonal entries > 0, counted twice in degree |
Spectral Graph Theory | Study of eigenvalues of adjacency matrix | Reveals structural properties of graph |
Glossary of Key Terms Related to Adjacency Matrices
Term | Meaning |
|---|---|
Adjacency Matrix | A square matrix representing connections between vertices in a graph |
Vertex (Node) | A fundamental unit or point in a graph |
Edge | A connection between two vertices in a graph |
Directed Graph | A graph where edges have a direction from one vertex to another |
Undirected Graph | A graph where edges have no direction |
Self-loop | An edge that connects a vertex to itself |
Permutation Matrix | A matrix used to reorder vertices in graph isomorphism |
Matrix Power | The result of multiplying a matrix by itself multiple times |
Walk | A sequence of vertices where each adjacent pair is connected by an edge |
Spectral Graph Theory | The study of properties of graphs through eigenvalues and eigenvectors of matrices |
Frequently Asked Questions on Adjacency Matrices
What does an entry of 1 in an adjacency matrix signify?
It indicates that there is an edge connecting the vertex corresponding to the row to the vertex corresponding to the column.
Why is the adjacency matrix symmetric for undirected graphs?
Because edges have no direction, the connection from vertex \( v_i \) to \( v_j \) is the same as from \( v_j \) to \( v_i \), making \( a_{ij} = a_{ji} \).
How can adjacency matrices be used to find the number of paths between vertices?
By computing powers of the adjacency matrix, the entry \( (i,j) \) in \( A^n \) gives the number of walks of length \( n \) from vertex \( v_i \) to vertex \( v_j \).
What is the significance of the diagonal entries in an adjacency matrix?
Diagonal entries represent self-loops; a zero means no loop, while a positive value indicates an edge from a vertex to itself.
Can two isomorphic graphs have different adjacency matrices?
Yes, because adjacency matrices depend on vertex labeling, but they are related by a permutation similarity transformation.