Minimum Spanning Trees
Spanning Trees
We can apply this concept to undirected, connected graphs
A spanning tree, given an undirected connected graph
such that, all vertices are reached by the edges in . is a tree

MST
Let
A tree
is a Spanning Tree - The weight of the tree
is the smallest out of all the spanning trees.

In fact, the minimality factor implies the fact we are working with weighted graphs.
If a graph is connected i.f.f. there exists at least one MST for that graph.
Algorithm for MST: crucial fact of MST (CF of MST)
Our focus will be primarily on the MST search. Two very famous algorithms for this are Kruskal and Prim.
But what do all algorithms of MST search have in common? If we execute a cut on a graph, and we take a light edge crossing the cut, there exists a MST containing that light edge.
CRUCIAL GENERAL FACT: We can also say that for any cut performed on a graph
, there must be at least one edge (crossing that cut), which belongs to an MST of .
Sew and Cut technique
This technique is at the base of the MST problem.
- We decide to SEW (add) an edge
to a tree , which causes it to become cyclic (it is no longer a tree nor a candidate MST). - To restore the tree properties we decide to CUT (remove) an edge which is in the same cycle but is heavier
. - We keep repeating this until we obtain one MST of
.
Let's consider a
- if
, we proved there exist an edge belonging to an MST. - if
, we can say for the CF of MST, there exist at least one more edge crossing the cut, because either of one them must belong to . - We suppose
is a light edge, then we know . - So
is not going to be a good candidate for an MST.
- So
- However, by SEWING
we obtain a cyclic graph - Which are not in the right conditions for an MST.
- Since
is a light edge, we can CUT and restore the properties. - In fact,
is an ST again and a candidate for MST.
- In fact,
- We suppose
Generic MST
Let's start with an incremental general algorithm thought to find MSTs for a graph.
| Operation | Input | Cons |
|---|---|---|
| Generic MST | A Graph | An MST |
Steps:
- Construct a set A that will contain the edges of the MST
- While |A| < |V| − 1
- Find a safe edge for A(u,v)
- Add it to A
- Return A
Generic_MST(G, w)
A[] = ⊘; #Empty Set
while (|A| < |V| − 1):
#find a safe edge for A (𝑢, 𝑣) ∈ 𝐸
𝐴 ← 𝐴 ∪ {(𝑢, 𝑣)}
return A;Generic_MST(G, w)
A[] = ⊘; #Empty Set
while (|A| < |V| − 1):
#find a safe edge for A (𝑢, 𝑣) ∈ 𝐸
𝐴 ← 𝐴 ∪ {(𝑢, 𝑣)}
return A;Since the third step is not clear, we cannot really implement it. Mind that, this is only an example and the algorithms we are going to see are mere variations.
Fundamental Theorem of MST
To introduce this theorem we must mind the following definitions :
- Cut (S, V\S) S⊆V
- Light Edge
- Safe Edge
Let G=(V,E, w) an undirected, connected, edge-weighted graph, if:
- A⊆E (can be empty), that is included in some MST for G.
- (S, {V\S}) be any cut of G that respects A
- No edge of A crosses (S, {V\S})
- (u,v)∈E be a light edge crossing the cut (S, {V\S})
Then, edge (u,v) is safe for A
- A' = A∪{(u,v)} is included in some MST T
This helps find a starting point to finish the incremental algorithm we have previously tried to implement!
- We can start from an empty set A', by definition it is subset of any set. This includes, all MST of G.
- We cut the graph, following the theorem's constraints
- We add the light edge to A', we have perfectly enlarged A'.
- Since A' = A∪{(u,v)} is included in some MST, we repeat step 2-3 until we have (n-1) edges.
- A' is a subset of some MST, and would be itself an MST.
Demonstration
Let T∈E be a MST including A. We have two cases
- if
(u,v)∈T, We stop here, since we found a tree where A ∪ {(u,v)} ⊆ T is an MST. - if
(u,v)∉T, We proceed like in the Sew&Cut technique 2. We sew:T ∪ {(u,v)}- The result is a cyclic graph, and there is at least another edge (x,y) crossing the cut (for CF of MST).
- We cut:
T' = T ∪{(u,v)}\{(x,y)}, which is an MST - T' is an ST, for sure. We can prove it is also an MST,
W(T') = W(T)W(T)<=W(T'), because T is an MST, by hypothesisW(T')<=W(T), becauseW(T')=W(T)+W((u,v))-W(x,y)andW((u,v))-W(x,y)<=0- W((u,v))<=W(x,y) since (u,v) is a light edge, true by point 3 of FT of MST
- We need to find whether A∪{(u,v)} ⊆ T', with T' being an MST
- (u,v)⊆ T', is true by construction
- A⊆ T', is true
- If (x,y)⊆A then we cannot prove our point, because
A ∪{(x,y)}is not contained in some MST - But, we know the cut respects A, by hypothesis.
- So surely (x,y) crosses the cut and (x,y)∉A.
- If (x,y)⊆A then we cannot prove our point, because
Observation 1
w(u,v) = w(x,y), they have the same weight!
- Since T was an MST, but also T' is an MST.
This means there these edges are both light edges, with the same weight, and both cross the cut.
- If we have a graph, with different weights for each edge, and we execute a cut the light edge is obviously unique.
- Trivially, when we "Sew" we have at least two light edges. But here there is only one!
Observation 2
Given a cut (S, {V\S}), with S⊆V.
- If the light edge (u,v) crossing the cut, is unique then, all MST include (u,v)
- If there was an MST not including (u,v), we could add it
- This creates a cycle, where there is at least one edge (x,y) which crosses the cut which we would remove.
- w((x,y)) > w((u,v))
- The resulting ST would have weight smaller than the starting MST. Absurd.
Corollary 23.2[CLRS]
Let G=(V,E, w) be a connected, undirected graph with a real-valued weight function w defined on E.
- Let A⊆E, be included in some minimum spanning tree for G
- Let C=(V(C), E(C)) be a connected component (tree) in the forest G(A) = (V,A)
- If (u,v) is a light edge connecting C to some other component in G(A)
Then (u,v) is safe for A

Demonstration
Exercises
Ex1: Corollary 23.2 exercise
A ⊆ some MST. A is a forest (acyclic graph made up of many CC) or just a tree.
Ex2
By taking a minimum edge, surely there is a MST that contains it. Demonstrate this!