Skip to main content

Chapter 28 Minimum Spanning Trees

Exercises Practice Problems

1. Prim's Algorithm.

Prim's Algorithm "grows a minimum edge into a MST." Given weighted graph \(G=(V,E)\text{:}\)

  • Initialize \(T\) to be a vertex \(v\)

  • At each step, grow the tree:

    • Add the minimum weight edge adjacent to \(T\) that doesn't create a cycle.

  • Stop when you can't add more edges.

Use Prim's Algorithm to find the MST of the following weighted graph.

Solution.

2. Kruskal's Algorithm.

Kruskal's Algorithm grows a minimum forest until it is a MST. Given weighted graph \(G=(V,E)\text{:}\)

  • Initialize \(T\) to contain all the vertices of \(G\text{,}\) but no edges.

  • At each step, grow the forest:

    • Add the minimum weight edge to \(T\) that doesn't create a cycle.

  • Stop when you can't add more edges.

Solution.

3. MST Examples.

Give an example of a weighted graph on 6 vertices that \(\ldots\)

  1. has a unique minimum spanning tree. Solution.

  2. has exactly 2 minimum spanning trees. Solution.

  3. has more than 2 minimum spanning trees. Solution.

4. A Minimum Edge.

Let \(G=(V,E)\) be a weighted graph.

  1. Suppose that \(G\) contains a unique edge \(e\) of minimum weight in \(G\text{.}\) Prove that \(e\) is contained in every minimum spanning tree of \(G\text{.}\) Solution.

    AFSOC that \(T\) is a minimum spanning tree that does not contain \(e\text{.}\) Then \(T+e\) contains a cycle \(C\text{.}\) The edge \(e\) has the unique minimum weight in this cycle. So let \(f\) be any other edge in \(C\text{.}\) The spanning tree \(T-f+e\) has smaller weight than \(T\text{,}\) a contradiction.

  2. Suppose that \(G\) contains an edge \(e\) such that for every cycle \(C\) containing \(e\text{,}\) the weight \(w(e)\) is smaller than all the other edge weights in \(C-e\text{.}\) Prove that \(e\) is contained in every minimum spanning tree of \(G\text{.}\) Solution.

    The proof is exactly the same as the previous part.

5. Minimum Spanning Forest.

Extend the concept of a minimum spanning tree to a disconnected, weighted graph. Define a "minimum spanning forest" and describe how you would find it. Solution.

A minimum spanning forest for a graph with components \(G_1, G_2, \ldots, G_k\) is a forest \(T_1, T_2, \ldots, T_k\) where \(T_i\) is a minimum spanning tree for component \(G_i\text{.}\) Kruskal's algorithm actually creates a minimum spanning forest for a disconnected graph.