Leaving Certificate Applied Mathematics2.6 Minimum spanning trees: Kruskal's algorithm

All books

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.

  1. Kruskal's algorithm starts by sorting the edges. The weights of a network's edges are 4,2,1,8,5,10,2,6,34, 2, 1, 8, 5, 10, 2, 6, 3. Write them in the order Kruskal's algorithm considers them.
  2. A network has edges AB=4AB = 4, AC=2AC = 2, BC=1BC = 1, BD=5BD = 5, CD=8CD = 8, CE=10CE = 10, DE=2DE = 2, DF=6DF = 6, EF=3EF = 3. Use Kruskal's algorithm to find the total weight of a minimum spanning tree.
  3. For that network, list the edges in the minimum spanning tree and say how many edges it has.
  4. In Kruskal's algorithm, why is an edge rejected, and what happens to it?
  5. 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?
  6. 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: 1,2,2,3,4,5,6,8,101, 2, 2, 3, 4, 5, 6, 8, 10. The sum is 4141, 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 BC=1BC = 1, AC=2AC = 2, DE=2DE = 2, EF=3EF = 3, AB=4AB = 4, BD=5BD = 5, DF=6DF = 6, CD=8CD = 8, CE=10CE = 10. Kruskal takes BCBC, then ACAC, then DEDE, then EFEF, then skips ABAB (it would close the cycle A−B−C−AA-B-C-A), then takes BDBD (the first edge joining the group {A,B,C}\{A,B,C\} to the group {D,E,F}\{D,E,F\}). That is 5 edges for 6 vertices, so it is a spanning tree, with total weight 1+2+2+3+5=131 + 2 + 2 + 3 + 5 = 13.

3. Show the answer

3. The edges, then the count

Answer: The edges are BCBC, ACAC, DEDE, EFEF and BDBD, five in all. The count is forced: every spanning tree on 6 vertices has 6−1=56 - 1 = 5 edges. The weight 1313 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.

Settings

Colour scheme

Light or dark pages. Your colour and layout stay the same.

Colour

The paper, ink and lettering. Your layout stays the same.

Quiet colours
Bold colours
Layout

How pages are arranged. Your colours stay the same.

Reading offline

Keep this book on this device and read it offline.