A connected network that contains no cycles is called a tree. These have a distinctly tree-like appearance:
Once you leave a vertex on any of these networks, you can’t get back to it without repeating an edge.
Any connected network can have edges removed, taking care not to disconnect the network, until the result is a subnetwork that is a tree - this is then called a spanning tree.
Here’s an example:
The network in the centre has its eight different spanning trees arranged around it. You can still get from one vertex to any other, but you can’t get back without repeating an edge.
A connected network that isn’t already a tree can have multiple spanning trees. The network below has 11 possible spanning trees:
Here are all the spanning trees, with their weights.
The last spanning tree is special, since it has the lowest weight out of all of them. We call it the minimal spanning tree. Sometimes there can be two or more spanning trees with equal lowest weight, in which case they are all minimal spanning trees.
Here’s a network with two minimal spanning trees:
Can you find both of them? It can be quite hard and take a long time.
Consider the following graphs.
Which of these networks is a tree?
Why is the following graph not a tree?
Why is the following graph not a tree?
Trees are a connected networks that do not have cycles or loops.
A spanning tree is a subnetwork of a connected network that is also a tree. It has no cycles or loops.
A network has a spanning tree only if all the vertices are connected to the same network.
A minimal spanning tree is a spanning tree with the lowest total weight of edges.
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:
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? Feel free to find them all and add up all their weights, but it’s 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.
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):
Pick any vertex to start the spanning tree.
Locate the lowest weight edge connected to the spanning tree.
If this edge would create a cycle, reject it.
If there is more than one edge with the lowest weight, pick any of them.
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.
Which two of the following are possible minimal spanning trees?
What is the minimum time taken to build a network of tracks that connect each landmark?
Prim’s algorithm (from a network):
Pick any vertex to start the spanning tree.
Locate the lowest weight edge connected to the spanning tree.
If this edge would create a cycle, reject it.
If there is more than one edge with the lowest weight, pick any of them.
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.