topic badge
AustraliaVIC
VCE 12 General 2023

9.01 Minimum connector problems

Lesson

Introduction

Here’s a network with two minimal spanning trees:

This image shows a network with weighted edges. Ask your teacher for more information.

Can you find both of them? It can be quite hard and take a long time.

Prim's algorithm

Sometimes it is going to be very impractical to find a minimal spanning tree by eye. The following network represents a mycorrhizal nutrient transfer system:

This image shows the mycorrhizal nutrient transfer system network. Ask your teacher for more information.

\,

These underground connections are created and maintained by the fungus to connect and nurture the roots of plants (represented here by the vertices) under the ground. The weights represent distance in metres.

A severe drought is affecting the area, so only the most essential connections can be sustained by the fungus. What is the shortest total distance that the mycorrhizal network needs to spread itself across, while still making sure that every plant is connected to every other one?

We need to find the minimal spanning tree. This particular network has 416 spanning trees, which one is minimal? To add up all their weights is going to take a very long time.

Instead, we’re going to use a procedure called Prim’s Algorithm to find the minimal spanning tree without having to find all the spanning trees. The algorithm was first created by Vojtech Jarník, a Czech mathematician, in 1930. Both Robert Prim (in 1957) and Edsger Dijkstra (in 1959) independently rediscovered it, though Prim’s work popularised its use.

This image shows a weighted network. Ask your teacher for more information.

We begin by picking a vertex, any vertex will do. Let’s say we pick F. We then highlight the lowest weight edge coming out of F.

We then add this edge, and the vertex on the other side, to our spanning tree.

This image shows a weighted network. Ask your teacher for more information.

Then we do the same thing again. Highlight the edge of lowest weight coming out of our spanning tree.

The vertex F was just a starting point - the lowest weight edge connected to the spanning tree comes out of E, now.

We then add that edge, and its vertex, to the spanning tree.

This image shows a weighted network. Ask your teacher for more information.

\,

Once again, we highlight the lowest weight edges coming out of the spanning tree.

This time, there are two candidates. Both DC and DF have weight 12. We can pick either one at this point.

This image shows a weighted network. Ask your teacher for more information.

However, DF cannot be used because that would create a loop. So we include the edge DC.

Edges connecting vertices already in the spanning tree will always be rejected.

This image shows a weighted network. Ask your teacher for more information.

Now we move on to highlight the next lowest weight edge connected to our spanning tree which is BF.

This edge doesn’t create a cycle, so we add it into the growing spanning tree.

This image shows a weighted network. Ask your teacher for more information.

\,

The next lowest weight edges are all weight 14 so we highlight them all.

This image shows a weighted network. Ask your teacher for more information.

Once again, we reject the edge DB since it would create a cycle.

That leaves us with two choices.

This image shows a weighted network. Ask your teacher for more information.

\,

We are free to pick either of these. We add in the edge and the vertex, growing the spanning tree by one vertex every step.

This image shows a weighted network. Ask your teacher for more information.

\,

Instead of going back to the edge EG of weight 14, we now have an edge connected to our spanning tree of lower weight, AG.

This image shows a weighted network. Ask your teacher for more information.

We add that in as before, and highlight the lowest weight edge connecting the spanning tree to our final vertex.

We add this edge and vertex into the network, completing the procedure.

This image shows the minimum spanning tree of a network. Ask your teacher for more information.

\,

We can delete the unused edges for a clearer picture of our final result.

Our fungus spanning tree has grown from the vertex F to cover every plant in the area, and it covers 12+10+10+13+14+8+7=74 metres in total.

This procedure is guaranteed to find the minimal spanning tree every time. Much easier than finding all the spanning trees and adding up all their weights. Here’s a summary of the procedure.

Prim’s algorithm (from a network):

  1. Pick any vertex to start the spanning tree.

  2. Locate the lowest weight edge connected to the spanning tree.

  3. If this edge would create a cycle, reject it.

  4. If there is more than one edge with the lowest weight, pick any of them.

  5. Add this edge and the vertex at the other end to the spanning tree. If all vertices are part of the spanning tree, stop. Otherwise, repeat from step 2.

Examples

Example 1

This image shows a network of walking tracks. Ask your teacher for more information.

The rangers of a national park want to clear walking tracks to 6 landmarks in the area. The potential tracks between landmarks are shown in the graph, along with the number of days required to clear each track for use.

To make a network of tracks in the shortest time, the rangers want to find a minimal spanning tree for the graph.

a

Which two of the following are possible minimal spanning trees?

A
This image shows a network highlighting a spanning tree. Ask your teacher for more information.
B
This image shows a network highlighting a spanning tree. Ask your teacher for more information.
C
This image shows a network highlighting a spanning tree. Ask your teacher for more information.
D
This image shows a network highlighting a spanning tree. Ask your teacher for more information.
Worked Solution
Create a strategy

Use the Prim's Algorithm to test each option.

Apply the idea

All the spanning trees seem to have started from vertex A. From vertex A we could move to either B or F since both edges AB and AF have a weight of 7.

If we move to vertex B, we would move to vertex E then D then C by following the edges with the lowest weights. We still need to connect to vertex F so we would also include the edge EF since its weight is lower than the weight of AF. This tree corresponds to option C, and has a total weight of: 7+4+2+6+6=25.

If we move to vertex F, we would move to vertex E then D then C by following the edges with the lowest weights. We still need to connect to vertex B so we would also include the edge EB since its weight is lower than the weights of AB, CB and DB. This tree corresponds to option A, and has a total weight of: 7+6+4+2+6=25.

So the possible minimal spanning trees are in options A and C.

b

What is the minimum time taken to build a network of tracks that connect each landmark?

Worked Solution
Create a strategy

Add the weights of edges of the minimum spanning trees found in part (a).

Apply the idea

In part (a) we found that the total weight of both minimal spanning trees was 25.

The minimum time taken to build a network of tracks is 25 days.

Idea summary

Prim’s algorithm (from a network):

  1. Pick any vertex to start the spanning tree.

  2. Locate the lowest weight edge connected to the spanning tree.

  3. If this edge would create a cycle, reject it.

  4. If there is more than one edge with the lowest weight, pick any of them.

  5. Add this edge and the vertex at the other end to the spanning tree. If all vertices are part of the spanning tree, stop. Otherwise, repeat from step 2.

Outcomes

U4.AoS2.3

communication and dominance matrices and their application

U4.AoS2.10

recognise the minimum connector problem and solve it by utilising the properties of trees, spanning trees and by determining a minimum spanning tree by inspection or using Prim’s algorithm for larger scale problems

What is Mathspace

About Mathspace