FINITE MATHEMATICS • LOGIC, SETS, AND NETWORKS

Network Representations — Represent networks as graphs and interpret adjacency

Learn how graphs encode relationships and how adjacency matrices translate network structure into computable form.

Historical Context & Motivation

The formal study of networks as mathematical objects has roots stretching back to the eighteenth century, when Leonhard Euler posed a deceptively simple question about walking across the bridges of Königsberg. His 1736 paper showed that the physical layout of the bridges was irrelevant; what mattered was which landmasses were connected to which. That insight—stripping away geometry to focus on connections—gave birth to graph theory, the mathematical backbone of modern network science. Today, graph-based representations underpin algorithms in social-network analysis, logistics, epidemiology, computer networking, and operations research, making them indispensable tools in finite mathematics.

1736
Euler and the Königsberg Bridges
Euler abstracts the Königsberg bridge problem into vertices and edges, founding graph theory and proving no Eulerian path exists for the configuration.
1878
Cayley's Tree Enumeration
Arthur Cayley uses graph-theoretic methods to enumerate chemical isomers, demonstrating the first major application of graphs outside pure mathematics.
1936
König's Graph Theory Textbook
Dénes König publishes the first comprehensive textbook on graph theory, formalizing adjacency and degree concepts and establishing the field as a standalone discipline.
1959
Erdős–Rényi Random Graphs
Paul Erdős and Alfréd Rényi introduce random graph models, inaugurating the probabilistic study of large-scale network structure.
1999
Barabási–Albert Scale-Free Networks
Barabási and Albert propose a preferential-attachment model explaining power-law degree distributions observed in the World Wide Web and biological networks.

Despite centuries of development, the core question remains the same: How do we represent a real-world network in a precise, computable form so that we can analyze its structure and draw conclusions? This lesson addresses that question by introducing graph models, adjacency matrices, and adjacency lists—the standard representations that bridge intuitive network diagrams and rigorous mathematical analysis.

Core Principles & Definitions

A graph is an ordered pair G = (V, E), where V is a finite set of vertices (also called nodes) and E is a set of edges (also called links or arcs) that express pairwise relationships among elements of V. Edges may be undirected, meaning the relationship is symmetric—like a two-way street—or directed, meaning one vertex points to another—like a one-way street. The following foundational ideas form the scaffolding upon which all network analysis rests.

1

Vertex (Node)

A fundamental unit in a graph representing an entity—person, city, webpage, or abstract element. The set V = {v₁, v₂, …, vₙ} has order n = |V|.
2

Edge (Link)

A pair of vertices encoding a relationship. In an undirected graph, edge {u, v} is the same as {v, u}. In a directed graph (digraph), the ordered pair (u, v) is distinct from (v, u).
3

Adjacency

Two vertices are adjacent if an edge connects them. Adjacency can be recorded in a matrix A where aᵢⱼ = 1 if vᵢ and vⱼ share an edge and 0 otherwise.
4

Degree

The degree of a vertex is the number of edges incident to it. In a digraph, the in-degree counts incoming edges and the out-degree counts outgoing edges.
5

Weighted vs. Unweighted

An unweighted graph treats all edges equally; a weighted graph assigns a numerical value (cost, distance, capacity) to each edge, enriching the model for optimization.
KEY TAKEAWAY
Think of a graph the way a transit planner thinks of a subway map. The stations are vertices and the rail lines are edges. The map deliberately ignores geography—curves, distances, and terrain—because the only question that matters is which stations connect to which. Similarly, a graph strips a real-world network down to its connectivity skeleton, enabling algorithmic analysis without visual clutter.

Visual Explanation — Graph Diagram

The diagram below illustrates an undirected graph with five vertices (labeled A through E) and seven edges. Each vertex is drawn as a colored circle, and each edge is rendered as a line segment between two vertices. Notice that vertex C has the highest degree (four edges), while vertex E has the lowest degree (two edges). The spatial positions of the vertices are arbitrary—what matters is which pairs are connected.

Figure 1 — An undirected graph on five vertices. Vertex C (amber) serves as a hub with degree 4, while vertices D and E sit at the periphery with degree 2. The Handshaking Lemma confirms that the total degree (3 + 3 + 4 + 2 + 2 = 14) equals twice the number of edges (2 × 7 = 14).

Several structural features are visible at a glance. Vertices A, B, and C form a triangle (a 3-cycle), and every vertex is reachable from every other vertex through some sequence of edges, making the graph connected. These observations—cycles, connectivity, vertex degrees—are precisely the kinds of questions that adjacency representations let us answer computationally.

Mathematical Framework — Adjacency Matrices & Lists

While a node-and-link diagram conveys intuition, algorithms require a data structure. The two most common representations are the adjacency matrix and the adjacency list. Each encodes the same connectivity information but optimizes for different computational tasks.

The Adjacency Matrix

ADJACENCY MATRIX DEFINITION
A = [aᵢⱼ] where aᵢⱼ = 1 if {vᵢ, vⱼ} ∈ E, aᵢⱼ = 0 otherwise
A is an n × n matrix (n = |V|). For an undirected graph, A is symmetric: aᵢⱼ = aⱼᵢ. For a weighted graph, replace 1 with the edge weight wᵢⱼ.
DEGREE FROM THE MATRIX
deg(vᵢ) = Σⱼ aᵢⱼ (sum of the i-th row)
For a directed graph, the row sum gives the out-degree and the column sum gives the in-degree of vᵢ.
WALKS OF LENGTH k
(Aᵏ)ᵢⱼ = number of distinct walks of length k from vᵢ to vⱼ
Raising the adjacency matrix to the k-th power and inspecting entry (i, j) counts all walks of exactly k edges between those two vertices. This result is central to reachability analysis.

The Adjacency List

An adjacency list associates each vertex vᵢ with the set of its neighbors, Adj(vᵢ). For the graph in Figure 1: Adj(A) = {B, D, C}, Adj(B) = {A, C, E}, Adj(C) = {A, B, D, E}, Adj(D) = {A, C}, and Adj(E) = {B, C}. The list representation uses Θ(|V| + |E|) space rather than the Θ(|V|²) required by a full matrix, making it preferable for sparse graphs—graphs where |E| is much smaller than |V|². Conversely, the adjacency matrix supports constant-time edge queries (simply check aᵢⱼ) and matrix operations that reveal deeper structural properties such as walk counts and spectral information.

Directed and Weighted Graph Representations

Many real-world networks are inherently asymmetric or carry quantitative information along their edges. A directed graph (digraph) replaces unordered edge sets {u, v} with ordered pairs (u, v), indicating that the relationship flows from u to v. The adjacency matrix of a digraph is generally asymmetric: aᵢⱼ may differ from aⱼᵢ. In a weighted graph, each edge carries a numerical weight representing cost, capacity, distance, or probability, and the adjacency matrix stores those weights instead of ones. The diagram below shows a small directed, weighted network alongside its adjacency matrix.

Figure 2 — A directed, weighted graph on four vertices with five arcs. The adjacency (weight) matrix W is displayed on the right. Entry w₁₂ = 4 corresponds to the arc from vertex 1 to vertex 2 with weight 4. Zero entries indicate the absence of a direct arc. Note that W is not symmetric, reflecting the directedness of the graph.
Comparison of undirected and directed simple graphs
FeatureUndirected GraphDirected Graph
Edge notation{u, v} (unordered pair)(u, v) (ordered pair)
Adjacency matrix symmetrySymmetric (aᵢⱼ = aⱼᵢ)Generally asymmetric
Degree definitionSingle degree = row sumIn-degree (col sum) and out-degree (row sum)
Max edges (simple)n(n − 1) / 2n(n − 1)

Worked Example — Building and Analyzing an Adjacency Matrix

Consider an undirected network of four cities—Atlanta (A), Boston (B), Chicago (C), and Denver (D)—with direct flights between A–B, A–C, B–C, and C–D. We wish to construct the adjacency matrix, read off the vertex degrees, and determine the number of walks of length 2 from A to D.

Adjacency Matrix Construction & Walk Counting
1
Step 1 — List Vertices and EdgesDefine V = {A, B, C, D} with n = 4. The edge set is E = { {A,B}, {A,C}, {B,C}, {C,D} }, giving |E| = 4.
V = {A, B, C, D}, |E| = 4
2
Step 2 — Construct the Adjacency Matrix AIndex the rows and columns as A = 1, B = 2, C = 3, D = 4. Set aᵢⱼ = 1 whenever {vᵢ, vⱼ} ∈ E and 0 otherwise. Because the graph is undirected, A is symmetric. The resulting matrix is: A = [[0,1,1,0],[1,0,1,0],[1,1,0,1],[0,0,1,0]].
Row 1: [0 1 1 0], Row 2: [1 0 1 0], Row 3: [1 1 0 1], Row 4: [0 0 1 0]
3
Step 3 — Read Off DegreesSum each row: deg(A) = 0+1+1+0 = 2, deg(B) = 1+0+1+0 = 2, deg(C) = 1+1+0+1 = 3, deg(D) = 0+0+1+0 = 1. Verify via the Handshaking Lemma: total degree = 2+2+3+1 = 8 = 2 × 4 = 2|E|. ✓
deg(A) = 2, deg(B) = 2, deg(C) = 3, deg(D) = 1
4
Step 4 — Compute A² for Walks of Length 2Multiply A by itself. The entry (A²)₁₄ gives the number of walks of length 2 from A to D. Computing the (1,4) entry: (A²)₁₄ = a₁₁·a₁₄ + a₁₂·a₂₄ + a₁₃·a₃₄ + a₁₄·a₄₄ = 0·0 + 1·0 + 1·1 + 0·0 = 1. So there is exactly one walk of length 2 from A to D, namely A → C → D.
(A²)₁₄ = 1 — exactly one walk of length 2 from Atlanta to Denver (via Chicago)
5
Step 5 — Interpret the Full A²The complete A² = [[2,1,1,1],[1,2,1,1],[1,1,3,0],[1,1,0,1]]. The diagonal entries (A²)ᵢᵢ equal the degree of vertex vᵢ (each edge from vᵢ to a neighbor and back constitutes a walk of length 2 returning to vᵢ). Notice (A²)₃₄ = 0: there is no walk of length 2 from C to D, since D's only neighbor is C itself, so any walk C → D → ? must return to C, not arrive at D.
Diagonal of A² = [2, 2, 3, 1] confirms vertex degrees; (A²)₃₄ = 0 means no 2-walk from C to D.

Strengths & Limitations of Representation Methods

Choosing between an adjacency matrix and an adjacency list is not merely a matter of preference; it is a design decision that affects both memory consumption and algorithmic efficiency. The table below summarizes the key trade-offs for a graph with n vertices and m edges.

Adjacency matrix vs. adjacency list: time and space trade-offs
Operation / MetricAdjacency MatrixAdjacency List
Space complexityΘ(n²)Θ(n + m)
Check if edge existsO(1) — direct index lookupO(deg(v)) — scan neighbor list
Enumerate neighbors of vO(n) — scan entire rowO(deg(v)) — traverse list
Add an edgeO(1)O(1) amortized
Matrix operations (Aᵏ, eigenvalues)Natural — standard linear algebraRequires conversion to matrix first
Best suited forDense graphs, spectral analysisSparse graphs, traversal algorithms
KEY TAKEAWAY
The choice between a matrix and a list mirrors the choice between a spreadsheet and a contact list on your phone. If you need to look up any person's connection to any other person instantly, the spreadsheet (matrix) wins. But if most people know only a handful of others and you mainly want to iterate through someone's friends, the contact list (adjacency list) is far more memory-efficient. In practice, most large-scale real-world networks—social graphs, web links, biological networks—are sparse, favoring adjacency lists for storage and traversal.

Connection to Advanced Theory

The adjacency matrix is far more than a bookkeeping device. Its algebraic properties open doors to spectral graph theory, random walks, network centrality measures, and algebraic connectivity. The table below previews how the foundational concepts introduced in this lesson connect to more advanced topics you may encounter in graph theory, linear algebra, or data science courses.

From introductory concepts to advanced network theory
This LessonAdvanced Extension
Adjacency matrix ALaplacian matrix L = D − A, used to analyze connectivity and clustering
Walk counts via AᵏEigenvalue decomposition: Aᵏ = PΛᵏP⁻¹ enables efficient computation of large powers
Vertex degreeDegree centrality, betweenness centrality, and PageRank in network analysis
Weighted edgesShortest-path algorithms (Dijkstra, Floyd–Warshall) and minimum spanning trees
Sparse vs. dense classificationSparse matrix storage formats (CSR, CSC) in computational science

One particularly elegant result is the connection between the eigenvalues of A and the structure of G. The largest eigenvalue λ₁ of the adjacency matrix satisfies δ ≤ λ₁ ≤ Δ, where δ and Δ are the minimum and maximum vertex degrees, respectively. Spectral methods exploit these eigenvalues to detect communities, estimate graph expansion, and even determine whether two graphs are isomorphic (under certain conditions). Thus, mastering adjacency representations is a prerequisite for virtually every advanced topic in network science.

Practice Problems

PROBLEM 1CONCEPTUAL
Explain why the adjacency matrix of an undirected graph is always symmetric, while the adjacency matrix of a directed graph is generally not. What structural property of the graph does symmetry reflect?
PROBLEM 2BASIC CALCULATION
Consider the undirected graph on vertices {1, 2, 3, 4} with edges {1,2}, {1,3}, {2,3}, {3,4}. Write the 4 × 4 adjacency matrix A and compute the degree of each vertex using row sums.
PROBLEM 3INTERMEDIATE
Using the adjacency matrix A from Problem 2, compute A² and determine how many walks of length 2 exist from vertex 1 to vertex 4. List all such walks explicitly.
PROBLEM 4APPLIED
A small company has four departments: HR (H), Engineering (E), Marketing (M), and Sales (S). Communication flows are directed: H → E, H → M, E → S, M → S, S → H. Construct the adjacency matrix of this directed communication network, compute the in-degree and out-degree of each department, and identify any department that can reach all others within two steps.
PROBLEM 5CRITICAL THINKING
Prove that for any undirected simple graph G with adjacency matrix A, the trace of A² equals twice the number of edges in G. That is, show tr(A²) = 2|E|.

Summary & Key Concepts

A graph G = (V, E) models a network by abstracting entities as vertices and relationships as edges. Two vertices sharing an edge are called adjacent. The adjacency matrix A is an n × n matrix whose entry aᵢⱼ equals 1 (or the edge weight) when vertices vᵢ and vⱼ are connected and 0 otherwise. For undirected graphs, this matrix is symmetric; for directed graphs it is generally not. Row sums give vertex degrees (or out-degrees), while the entries of Aᵏ count walks of length k between vertex pairs.

An alternative representation, the adjacency list, stores only the neighbors of each vertex and uses Θ(n + m) space, making it ideal for sparse graphs. Dense graphs and analyses requiring matrix algebra—such as spectral methods, walk enumeration, and centrality computations—favor the matrix form. Together, these representations provide the computational foundation for all network algorithms studied in finite mathematics, from shortest paths and spanning trees to flow optimization and community detection.

Varsity Tutors • Finite Mathematics • Network Representations — Represent networks as graphs and interpret adjacency