Meaning and conditions
Step-by-step reasoning
Consider the components already selected. The next cheapest edge connecting two components can be included in an optimum: if an optimal tree omits it, adding it creates a cycle. That cycle contains another edge across the same cut. Replacing that no-cheaper edge preserves a tree without increasing total cost. Thus after each greedy step at least one optimal completion remains possible.[1][2]
Prim uses the same safe-cut idea but grows a connected partial tree. Kruskal uses global edge order and cycle checks. Sorting dominates the usual O(|E| log |E|) Kruskal bound when components are managed efficiently.[2]
Connect all vertices with total weight 6
Three accepted edges build the tree
Free with a Quanta account. Your download stays ready after registration.
Two fully worked original examples
Kruskal selects three safe edges
- Given
- Four vertices; AB=1,BC=2,CD=3,AC=4,BD=5,AD=8.
- Find
- Construct a minimum spanning tree and justify its weight.
Sort all six edges by weight.
The first three edges create no cycle and connect all four vertices.
Every spanning tree needs three edges; no three-edge set can cost less than the three smallest weights combined.
Result: AB,BC,CD form an MST of total weight 6.
Check: The selected chain is connected and acyclic. Every selected edge is an existing undirected connection.
Ties: several optimal trees
- Given
- AB=AC=BC=1 and AD=BD=CD=2.
- Find
- Explain why all three cheapest edges cannot be selected.
The three unit-weight edges form a cycle on A,B,C while D remains isolated.
Two unit edges and one link to D form a tree.
Another valid tree reaches the same weight. At least one edge to D costs 2 and the remaining two cost at least 1 each.
Result: The minimum weight is 4; the optimal edge set is not unique.
Check: Both sets include all four vertices, exactly three edges and no cycle.
Recall the method later with the formula’s flashcards.
10 flashcards · English materials
Already have an account? Sign in for flashcardsAvailable from Essential. A ready-made formula set, no AI credits required. Article exercises are not all included.
Five exercises with solutions
Calculate · Foundation
Undirected graph: AB=2, AC=3, AD=10, BC=1, BD=8, CD=4. Find the minimum spanning-tree weight.
Show hint
After weights 1 and 2, inspect edge AC.
Learning goal: Reject a cheap cycle-forming edge despite its low weight.
Rearrange · Foundation
A tree has twelve vertices. How many edges does it have? Do eleven arbitrary edges prove a tree?
Show hint
The counting relation is necessary; connectivity is also required.
Learning goal: Separate the tree counting rule from its assumptions.
Interpret · Application
In the second example one program returns AB,AC,AD and another AB,BC,CD. Must one be wrong?
Show hint
Compare tree validity and total weight.
Learning goal: Recognize nonunique structure with a unique optimal value.
Error analysis · Application
A solution chooses AB,AC,BC in the second example because they are the three cheapest edges. What is wrong?
Show hint
Where is D, and which closed route appears?
Learning goal: Combine the greedy choice with the acyclicity condition.
Transfer · Application
A complete graph on A,B,C has AB=2,AC=2,BC=1. Compare an MST with shortest paths from A.
Show hint
MST total weight and individual source-to-target routes are different objectives.
Learning goal: Distinguish total network cost from route length.
Check your understanding with the formula’s reference test.
8 test questions · English materials
Already have an account? Sign in for the testAvailable from Essential. A ready-made formula set, no AI credits required. Article exercises are not all included.
Model limits and next steps
A disconnected graph has no single spanning tree covering all vertices; a minimum spanning forest treats its components. The fixed complete teaching graph is always connected.[1]
Dijkstra optimizes routes from one source. Graph foundations explain trees; Union-Find can manage Kruskal’s components.
Sources for this explanation
Quanta · Updated November 21, 2026
- TU München: Der Algorithmus von Prim — Minimale Spannbäume; Idee des Algorithmus; Konstruktion des MST
- RWTH Aachen, DSAL lecture 16: minimum spanning trees; Kruskal/Prim overview; PDF pp. 4–14 and the algorithm chapter (translated source label)
Editorial responsibility: Quanta Study editorial team
Review scope
This explanation, 2 worked examples and 5 exercises are available in German and English. Structure, source references and mathematical notation undergo automated checks. Calculations, model assumptions and both language versions receive a separate AI review.
An independent, named human subject review has not yet been documented. Our exercise numbers are worked examples, rather than measurements published by the cited sources.
Editorial responsibility, sources and methodsChange history
- Corrected visible word and number spacing in figure description and caption; preserved the graph, numerical values, examples and exercises.
- Created a DE/EN author draft with a bounded model, original graphic, two examples and varied solved exercises.
Cite this reference page
Quanta. Minimum spanning tree. Updated November 21, 2026. https://quanta-study.de/en/formula-sheet/minimaler-spannbaum
When citing a specific scientific statement, also cite the specialist source linked to that statement.