2.6 Minimum spanning trees: Kruskal's algorithm — Practise
Work independently. The questions and answers are shown together at the end.
Show the sorted edge list and a reason for every rejection. "Would close a cycle" is the reason, and naming the cycle is better still.
- Kruskal's algorithm starts by sorting the edges. The weights of a network's edges are . Write them in the order Kruskal's algorithm considers them.
- A network has edges , , , , , , , , . Use Kruskal's algorithm to find the total weight of a minimum spanning tree.
- For that network, list the edges in the minimum spanning tree and say how many edges it has.
- In Kruskal's algorithm, why is an edge rejected, and what happens to it?
- A student uses Kruskal's algorithm and gets a spanning tree of total weight 17. A classmate finds one of weight 14. What does this tell you about the student's answer, and what must be true of the classmate's?
- H Two edges of a network both have weight 3, and they are the next two Kruskal considers. Does it matter which is taken first? Explain.
Answers and concise solutions
1. Show the answer
1. The sorted order
Answer: In ascending order: . The sum is , which is only a way of confirming the same nine weights are present — the order is what matters for the algorithm. Where two weights are equal, either may be taken first.
2. Show the answer
2. Total weight of the minimum spanning tree
Answer: Sorting gives , , , , , , , , . Kruskal takes , then , then , then , then skips (it would close the cycle ), then takes (the first edge joining the group to the group ). That is 5 edges for 6 vertices, so it is a spanning tree, with total weight .
3. Show the answer
3. The edges, then the count
Answer: The edges are , , , and , five in all. The count is forced: every spanning tree on 6 vertices has edges. The weight is the smallest possible total.
4. Show the answer
4. Why an edge is rejected
Answer: An edge is rejected when the two vertices it joins are already connected by the edges chosen so far — adding it would close a cycle. A spanning tree has no cycles, so it is discarded. Because the edges are considered in ascending order and each is looked at once, a discarded edge is never needed later, and is not reconsidered.
5. Show the answer
5. What it tells you
Answer:
A spanning tree of weight 14 shows the student's tree of weight 17 is not a minimum spanning tree. It may still be a spanning tree; it is simply not the cheapest one. The classmate's tree is cheaper, but that alone does not prove it is minimum either — a third tree might be cheaper still. Only the algorithm, run correctly, guarantees the minimum.
6. Show the answer
6. Does the order matter?
Answer: It does not matter. When two edges have equal weight, either may be taken first, and the algorithm may produce a different tree — but never a different total weight. If one of them is rejected for closing a cycle, the other is still available. So equal weights can make the minimum spanning tree not unique, while the minimum weight stays the same.