upgrade
upgrade

📊Graph Theory

Key Concepts of Minimum Spanning Tree Algorithms

Study smarter with Fiveable

Get study guides, practice questions, and cheatsheets for all your subjects. Join 500,000+ students with a 96% pass rate.

Get Started

Why This Matters

Minimum Spanning Tree (MST) algorithms sit at the heart of graph theory and optimization—they answer a deceptively simple question: how do you connect everything with the least total cost? This concept powers real-world applications from network design and circuit layout to clustering algorithms and approximation schemes for NP-hard problems. You'll encounter MSTs whenever efficiency meets connectivity, making them a cornerstone of algorithm design and analysis.

Understanding these algorithms means grasping more than just their steps—you're being tested on greedy algorithm strategies, data structure selection, and time complexity trade-offs. Don't just memorize which algorithm sorts edges first; know why certain approaches excel on sparse versus dense graphs, how the cut property guarantees correctness, and when to reach for each tool. That conceptual foundation is what separates strong exam performance from rote recall.


Greedy Edge-Selection Algorithms

These algorithms build the MST by greedily selecting edges based on weight, relying on the cut property: the minimum-weight edge crossing any cut must belong to some MST.

Kruskal's Algorithm

  • Sorts all edges by weight globally—processes them in ascending order, making edge-centric decisions rather than growing from a single source
  • Uses a disjoint-set (union-find) data structure to efficiently track connected components and detect cycles in near-constant time per operation
  • Time complexity of O(ElogE)O(E \log E)—dominated by the initial sort, making it ideal for sparse graphs where EE is much smaller than V2V^2

Reverse-Delete Algorithm

  • Works backward from the complete graph—removes edges in decreasing weight order, keeping only those whose removal would disconnect the graph
  • Uses disjoint-set structure to verify connectivity after each potential deletion, similar machinery to Kruskal's but opposite direction
  • Time complexity of O(ElogE)O(E \log E)—theoretically equivalent to Kruskal's but often slower in practice due to connectivity checks

Compare: Kruskal's vs. Reverse-Delete—both use disjoint-set structures and achieve O(ElogE)O(E \log E) complexity, but Kruskal's builds up by adding safe edges while Reverse-Delete tears down by removing unnecessary ones. If asked to explain greedy MST strategies, Kruskal's is your cleaner example; Reverse-Delete demonstrates that greedy approaches can work in multiple directions.


Vertex-Growing Algorithms

These algorithms grow the MST outward from a starting vertex, repeatedly adding the cheapest edge that connects the tree to a new vertex. They leverage the priority queue as their central data structure.

Prim's Algorithm

  • Grows from a single seed vertex—at each step, adds the minimum-weight edge connecting the current tree to an unvisited vertex
  • Priority queue is essential—using a binary heap yields O(E+VlogV)O(E + V \log V) complexity; a Fibonacci heap improves this to O(E+VlogV)O(E + V \log V) with better constants
  • Excels on dense graphs—when EV2E \approx V^2, the vertex-focused approach outperforms edge-sorting methods

Jarník's Algorithm (Prim-Jarník Algorithm)

  • Historically the original vertex-growing approach—Jarník published this method in 1930, predating Prim's 1957 rediscovery
  • Identical mechanics to Prim's—uses priority queues, grows from a single vertex, and achieves the same O(E+VlogV)O(E + V \log V) time complexity
  • Name appears in theoretical contexts—knowing this is the same algorithm helps avoid confusion when reading academic sources or proofs

Compare: Prim's vs. Kruskal's—the classic MST showdown. Prim's is vertex-centric (grow the tree), Kruskal's is edge-centric (sort and merge). Choose Prim's for dense graphs with adjacency matrix representation; choose Kruskal's for sparse graphs or when edges are already sorted. FRQs often ask you to justify algorithm selection based on graph density.


Component-Merging Algorithms

This approach treats the graph as a forest of single-vertex trees and repeatedly merges components by their minimum outgoing edges—a naturally parallel strategy.

Borůvka's Algorithm

  • Processes all components simultaneously—in each phase, every component finds its minimum-weight outgoing edge, and all such edges are added at once
  • Logarithmic phases guarantee efficiency—the number of components at least halves each round, yielding O(ElogV)O(E \log V) time complexity
  • Highly parallelizable—the independent per-component operations make this ideal for distributed computing and GPU implementations

Compare: Borůvka's vs. Prim's—both grow trees, but Prim's grows one tree sequentially while Borůvka's grows all trees in parallel. Borůvka's O(ElogV)O(E \log V) complexity can outperform Prim's on certain graph structures, and its parallel nature makes it the go-to choice for large-scale distributed systems.


Quick Reference Table

ConceptBest Examples
Edge-centric greedy selectionKruskal's, Reverse-Delete
Vertex-growing with priority queuePrim's, Jarník's
Parallel component mergingBorůvka's
Best for sparse graphsKruskal's, Borůvka's
Best for dense graphsPrim's, Jarník's
Uses disjoint-set (union-find)Kruskal's, Reverse-Delete
Uses priority queuePrim's, Jarník's
Suitable for distributed computingBorůvka's

Self-Check Questions

  1. Which two algorithms share the same O(ElogE)O(E \log E) time complexity but approach the problem from opposite directions—one building up, one tearing down?

  2. If you're given a dense graph represented as an adjacency matrix, which algorithm would you choose and why? What data structure makes this choice efficient?

  3. Compare and contrast Kruskal's and Prim's algorithms in terms of their greedy strategies, data structures, and ideal graph types.

  4. Why is Borůvka's algorithm particularly well-suited for distributed computing environments, and what property of its execution enables parallelization?

  5. An FRQ asks you to prove that a greedy MST algorithm produces an optimal solution. Which fundamental property of MSTs would you invoke, and how does it guarantee that locally optimal edge choices lead to a globally optimal tree?