FINITE MATHEMATICS • LOGIC, SETS, AND NETWORKS

Minimum Spanning Trees — Minimum spanning tree concepts (intro)

Connecting every node at the lowest total cost — the foundation of efficient network design.

Historical Context & Motivation

The question of how to connect a set of locations with the least total wiring, piping, or roadway is as old as infrastructure planning itself. In graph-theoretic terms, this question asks: given a weighted, connected graph, which subset of edges forms a connected, acyclic subgraph — a spanning tree — whose total edge weight is minimized? The resulting structure is called a minimum spanning tree (MST). Although the concept feels modern, its roots stretch back to the early twentieth century and intertwine with the practical demands of electrical engineering, telecommunications, and combinatorial optimization.

1926
Borůvka's Algorithm
Czech mathematician Otakar Borůvka devised the first known MST algorithm while designing an efficient electrical power network for Moravia. His approach repeatedly added the cheapest edge from each connected component, merging components until a single tree remained.
1930
Jarník's Contribution
Vojtěch Jarník published a vertex-growing algorithm that is the direct precursor to what is now known as Prim's algorithm. Starting from an arbitrary vertex, it greedily extends the tree by always selecting the cheapest edge crossing the frontier.
1956
Kruskal's Algorithm
Joseph Kruskal formalized an edge-centric greedy strategy: sort all edges by weight and add them one by one, skipping any edge that would create a cycle. His paper placed MSTs squarely within the emerging discipline of combinatorial optimization.
1957
Prim's Re-discovery
Robert Prim independently re-derived Jarník's method and provided an efficient implementation, popularizing the vertex-growing approach. The algorithm now bears his name in most textbooks, though credit to Jarník is increasingly acknowledged.
1975–present
Advanced Developments
Researchers introduced near-linear-time algorithms (Chazelle, 2000) and randomized approaches (Karger, Klein, Tarjan, 1995). MSTs remain central to network design, clustering, image segmentation, and approximation algorithms for NP-hard problems.

The recurring question that motivated each of these milestones was deceptively simple: How can we connect everything using the least total cost, without any redundant connections? This introductory lesson formalizes that question, lays out the graph-theoretic prerequisites, and develops the core properties that make MSTs both elegant and computationally tractable.

Core Principles & Definitions

Before tackling the MST itself, we need to be precise about the underlying graph-theoretic vocabulary. A graph G = (V, E) consists of a set V of vertices (also called nodes) and a set E of edges connecting pairs of vertices. When every edge e ∈ E carries a numerical weight w(e) — representing cost, distance, or some other quantity — we call G a weighted graph. The MST problem is defined exclusively on weighted, connected, undirected graphs.

1

Spanning Subgraph

A subgraph T of G is spanning if it includes every vertex of G. In other words, V(T) = V(G). Edges may be omitted, but no vertex is left out.
2

Tree

A tree is a connected, acyclic graph. A tree on n vertices always has exactly n − 1 edges. Removing any edge disconnects it; adding any edge creates exactly one cycle.
3

Spanning Tree

Combining the two definitions: a spanning tree of G is a subgraph that contains all vertices of G, is connected, and has no cycles. It uses exactly |V| − 1 of G's edges.
4

Minimum Spanning Tree

A spanning tree T is minimum if the sum of its edge weights, w(T) = Σ w(e) for e ∈ E(T), is less than or equal to that of every other spanning tree of G.
5

Cut Property

For any cut (S, V\S) of G, the lightest edge crossing the cut is safe to include in some MST. This cut property is the theoretical engine behind both Prim's and Kruskal's algorithms.
KEY TAKEAWAY
Think of a minimum spanning tree like wiring a set of buildings with fiber-optic cable. You must reach every building (spanning), you want no loops because loops waste cable (tree), and you want the total cable length to be as short as possible (minimum). The MST is the cheapest network that keeps everyone connected without any redundant links.

Visual Explanation — From Graph to MST

The following diagram illustrates a weighted graph with six vertices and nine edges on the left, alongside its minimum spanning tree on the right. The MST retains exactly five edges — one fewer than the vertex count — and achieves the smallest possible total weight.

Left: a weighted graph G with vertices A–F and nine edges. Right: its MST retaining only five edges (highlighted in cyan). The MST is connected and acyclic, and no other spanning tree has a smaller total weight. Edge weights shown alongside each edge.

In the diagram, the original graph contains many possible spanning trees — for a graph with n vertices and m edges, the number of spanning trees can be enormous. The MST selects the specific tree with the smallest sum of edge weights. Observe that the MST uses edges with weights 1, 2, 3, 4, and 6 (total weight = 16), while bypassing heavier edges like the weight-8 diagonal and the weight-9 edge. Notice also that the MST is not necessarily unique: if two edges share the same weight, it is possible that multiple distinct MSTs exist, all sharing the same minimum total weight.

Mathematical Framework

Let G = (V, E, w) be a connected, undirected graph with vertex set V, edge set E, and weight function w : E → ℝ. A spanning tree T = (V, E_T) satisfies three conditions: (i) V(T) = V(G), (ii) T is connected, and (iii) T contains no cycles. From basic graph theory, these conditions collectively imply |E_T| = |V| − 1.

MST OBJECTIVE
w(T*) = min over all spanning trees T of G { Σ_{e ∈ E(T)} w(e) }
T* denotes a minimum spanning tree. The objective minimizes the total weight summed over all edges in the spanning tree. A graph may have multiple MSTs if edge weights are not all distinct, but all share the same optimal total weight.
EDGE COUNT IN A TREE
|E(T)| = |V| − 1
Any tree on n vertices has exactly n − 1 edges. This is provable by induction: a tree with one vertex has zero edges, and each vertex added contributes exactly one new edge to maintain connectivity without cycles.
CUT PROPERTY (FORMAL)
For any cut (S, V\S) in G, if e* is the unique lightest edge crossing the cut, then e* belongs to every MST of G.
A cut (S, V\S) partitions V into two non-empty subsets. An edge 'crosses' the cut if one endpoint is in S and the other in V\S. The cut property guarantees that greedy selection of minimum-weight crossing edges yields a correct MST.
CYCLE PROPERTY
For any cycle C in G, the unique heaviest edge in C does not belong to any MST of G.
The cycle property is the dual of the cut property. If an edge is the strictly heaviest edge on some cycle, removing it and using the rest of the cycle provides a cheaper alternative. Kruskal's algorithm implicitly uses this: an edge creating a cycle is rejected because the cycle's heaviest edge is never needed.

Together, the cut property and cycle property form the theoretical backbone of all classical MST algorithms. Any algorithm that consistently picks the lightest edge across some cut — and never includes an edge that would be the heaviest on a cycle — will converge to a minimum spanning tree. This greedy correctness is what makes MST problems solvable in polynomial time, in contrast to many other combinatorial optimization problems.

Key Properties & Structural Insights

Several structural properties of MSTs go beyond the basic definition and are essential for deeper analysis. Understanding these properties clarifies why MSTs behave the way they do and how algorithms exploit this structure.

The cut property in action: vertices are partitioned into sets S (amber) and V\S (violet). Three edges cross the cut (dashed red with weights 7 and 9, and solid green with weight 2). The lightest crossing edge — weight 2 — is guaranteed to appear in any MST.

Important MST Properties

Fundamental properties of minimum spanning trees
PropertyStatementSignificance
UniquenessIf all edge weights are distinct, G has exactly one MST.Eliminates ambiguity; any correct algorithm finds the same tree.
Cut PropertyThe unique minimum-weight edge crossing any cut belongs to every MST.Justifies greedy edge selection in Prim's algorithm.
Cycle PropertyThe unique maximum-weight edge on any cycle is excluded from every MST.Justifies edge rejection in Kruskal's algorithm.
Edge CountAn MST of a graph with n vertices always has exactly n − 1 edges.Provides a clear stopping criterion for algorithms.
Subgraph OptimalityEvery subtree of an MST is an MST of the subgraph it spans.Enables divide-and-conquer approaches like Borůvka's algorithm.
💡 When Is the MST Unique?
If all edge weights are distinct (no two edges share the same weight), then the MST is unique. When ties exist, there may be multiple MSTs, but they all have the same total weight. In practice, tie-breaking rules (e.g., lexicographic ordering of edge endpoints) can force a unique solution.

Worked Example — Finding an MST by Inspection

Consider a graph G with five vertices {A, B, C, D, E} and the following edges with weights: AB = 3, AC = 1, BC = 4, BD = 6, CD = 5, CE = 2, DE = 7. We will construct the MST using the greedy edge-selection approach of Kruskal's algorithm, which sorts edges by weight and adds them unless they form a cycle.

Constructing the MST of a 5-Vertex Graph
1
Step 1 — Sort All Edges by WeightList the edges in non-decreasing order of weight: AC = 1, CE = 2, AB = 3, BC = 4, CD = 5, BD = 6, DE = 7. We will process them in this order, attempting to add each edge to the growing forest.
Sorted edge list: {AC(1), CE(2), AB(3), BC(4), CD(5), BD(6), DE(7)}
2
Step 2 — Add AC (weight 1)The lightest edge is AC with weight 1. Adding it creates no cycle since A and C are currently in separate components. The forest now contains the edge {AC}. Components: {A, C}, {B}, {D}, {E}.
MST edges so far: {AC}. Running weight = 1.
3
Step 3 — Add CE (weight 2)Next is CE with weight 2. Vertex E is in its own component, while C is in {A, C}. Adding CE merges these, giving components: {A, C, E}, {B}, {D}. No cycle is formed.
MST edges so far: {AC, CE}. Running weight = 3.
4
Step 4 — Add AB (weight 3)Edge AB has weight 3. Vertex B is in its own component, A is in {A, C, E}. Adding AB merges B into the large component: {A, B, C, E}, {D}. Still no cycle.
MST edges so far: {AC, CE, AB}. Running weight = 6.
5
Step 5 — Skip BC (weight 4), Add CD (weight 5)Edge BC has weight 4, but both B and C are already in {A, B, C, E}. Adding BC would create a cycle, so we skip it. The next candidate is CD with weight 5. Vertex D is in its own component, so adding CD merges all vertices into a single component: {A, B, C, D, E}. We now have 4 = n − 1 edges, so the MST is complete.
MST edges: {AC, CE, AB, CD}. Total weight = 1 + 2 + 3 + 5 = 11.
Verification
We can verify this is optimal by checking: the tree has 4 edges for 5 vertices (correct for a tree), it is connected (every vertex is reachable), and no alternative spanning tree yields a lower total weight. Replacing CD(5) with BC(4) would disconnect D, requiring BD(6) or DE(7) instead, both of which increase the total.

Algorithm Comparison — Kruskal vs. Prim

Although a full algorithmic treatment is beyond this introductory lesson, understanding the conceptual difference between the two most common MST algorithms helps solidify the underlying theory. Both algorithms are greedy — they make locally optimal choices at each step — and both produce globally optimal MSTs, thanks to the cut and cycle properties established earlier.

Conceptual comparison of the two classical MST algorithms
FeatureKruskal's AlgorithmPrim's Algorithm
StrategyEdge-centric: sort all edges globally, add cheapest non-cycle-forming edge.Vertex-centric: grow a single tree from a start vertex, always adding the cheapest edge from the tree to a non-tree vertex.
Data StructureUnion-Find (disjoint set) to detect cycles efficiently.Priority queue (min-heap) to extract minimum-weight frontier edges.
Time ComplexityO(|E| log |E|), dominated by the initial edge sort.O(|E| log |V|) with a binary heap; O(|E| + |V| log |V|) with a Fibonacci heap.
Best suited forSparse graphs where |E| is close to |V|. Also naturally handles disconnected graphs (produces a minimum spanning forest).Dense graphs where |E| approaches |V|². The priority queue avoids sorting all edges upfront.
Theoretical BasisRelies primarily on the cycle property: reject the heaviest edge on any cycle.Relies primarily on the cut property: choose the lightest edge crossing the frontier cut.
KEY TAKEAWAY
Kruskal's algorithm is like building a jigsaw puzzle by finding matching pieces anywhere on the table and snapping them together — you work on multiple clusters that eventually merge. Prim's algorithm is like growing a crystal from a seed: you always extend the boundary of a single, expanding structure. Both strategies work because the greedy selection is provably safe, guaranteed by the cut and cycle properties.

Connections to Advanced Topics

The minimum spanning tree is not merely an end in itself — it serves as a foundational building block for more sophisticated graph algorithms and optimization problems. Recognizing where MSTs appear in the broader landscape of discrete mathematics and computer science helps motivate deeper study.

From introductory MST concepts to advanced applications
Introductory Concept (This Lesson)Advanced Extension
MST of a static, weighted graphDynamic MST: maintaining the MST as edges are inserted or deleted in real time (link-cut trees).
Greedy selection via cut/cycle propertiesMatroid theory: MSTs are an instance of optimizing a linear objective over a graphic matroid, generalizing greedy correctness.
Undirected, single-objective MSTSteiner tree problem: connect a specified subset of vertices at minimum cost (NP-hard). The MST provides a 2-approximation.
MST for network designTraveling Salesman Problem (TSP): the MST weight gives a lower bound, and doubling the MST gives a 2-approximation tour.
Single MST computationClustering via MST: removing the k − 1 heaviest MST edges partitions vertices into k clusters (single-linkage clustering).

Perhaps most striking is the connection to matroid theory. The set of all spanning forests of a graph forms a graphic matroid, and the MST is the minimum-weight base of this matroid. This abstraction explains why the greedy algorithm works for MSTs but fails for many other combinatorial optimization problems: greedy correctness is a defining property of matroids. As you advance into operations research or algorithm design, this connection becomes a powerful unifying theme.

Practice Problems

PROBLEM 1CONCEPTUAL
Explain why a minimum spanning tree of a connected graph with n vertices must contain exactly n − 1 edges. What would happen if the spanning subgraph had n edges? What if it had n − 2?
PROBLEM 2BASIC CALCULATION
Consider a graph with four vertices {P, Q, R, S} and edges PQ = 5, PR = 8, QR = 3, QS = 7, RS = 2. Find the MST and its total weight.
PROBLEM 3INTERMEDIATE
A connected graph G has 6 vertices, 10 edges, and all edge weights are distinct. How many edges will its MST contain? Suppose you remove the single heaviest edge from G (weight 20) before running an MST algorithm. Could this change the MST? Justify your answer using the cycle property.
PROBLEM 4APPLIED
A telecommunications company needs to lay fiber-optic cable connecting 5 data centers. The cost (in thousands of dollars) of direct connections are: A–B: 120, A–C: 90, A–D: 200, B–C: 80, B–D: 150, B–E: 110, C–D: 140, C–E: 100, D–E: 95. Find the MST and the minimum total cost of connecting all data centers.
PROBLEM 5CRITICAL THINKING
Prove or disprove: if we add a constant k > 0 to every edge weight in a graph G, the set of edges in the MST remains unchanged. Does the same hold if we multiply every edge weight by a positive constant c?

Summary — Minimum Spanning Tree Concepts

A minimum spanning tree of a connected, weighted, undirected graph is a spanning subgraph that is connected, acyclic (a tree), and has the smallest possible total edge weight. It always contains exactly n − 1 edges for a graph with n vertices. The two pillars of MST correctness are the cut property (the lightest edge crossing any partition must appear in the MST) and the cycle property (the heaviest edge on any cycle is excluded). These properties guarantee that greedy algorithms — notably Kruskal's (edge-centric) and Prim's (vertex-centric) — produce optimal solutions.

MSTs have a rich history stretching from Borůvka's 1926 algorithm for electrical networks to modern applications in clustering, network design, and approximation algorithms. When all edge weights are distinct, the MST is unique; otherwise multiple MSTs may exist but share the same optimal total weight. The MST also serves as a gateway to advanced topics including matroid theory, the Steiner tree problem, and TSP approximation, making it one of the most versatile concepts in combinatorial optimization.

Varsity Tutors • Finite Mathematics • Minimum Spanning Trees — Minimum spanning tree concepts (intro)