Minimum spanning trees
Minimum Connector Algorithms Kruskals algorithm 1.Select the shortest edge in a network 2.Select the next shortest edge which does not create a cycle 3.Repeat step 2 until all vertices have been connected Prims algorithm 1.Select any vertex 2.Select the shortest edge connected to that vertex 3.Select the shortest edge connected to any vertex already connected 4.Repeat step 3 until all vertices have been connected
A cable company want to connect five villages to their network which currently extends to the market town of Avonford. What is the minimum length of cable needed? Avonford Fingley Brinleigh Cornwell Donster Edan Example
We model the situation as a network, then the problem is to find the minimum connector for the network A F B C D E
A F B C D E List the edges in order of size: ED 2 AB 3 AE 4 CD 4 BC 5 EF 5 CF 6 AF 7 BF 8 CF 8 Kruskals Algorithm
Select the shortest edge in the network ED 2 Kruskals Algorithm A F B C D E
Select the next shortest edge which does not create a cycle ED 2 AB 3 Kruskals Algorithm A F B C D E
Select the next shortest edge which does not create a cycle ED 2 AB 3 CD 4 (or AE 4) Kruskals Algorithm A F B C D E
Select the next shortest edge which does not create a cycle ED 2 AB 3 CD 4 AE 4 Kruskals Algorithm A F B C D E
Select the next shortest edge which does not create a cycle ED 2 AB 3 CD 4 AE 4 BC 5 – forms a cycle EF 5 Kruskals Algorithm A F B C D E
All vertices have been connected. The solution is ED 2 AB 3 CD 4 AE 4 EF 5 Total weight of tree: 18 Kruskals Algorithm A F B C D E
A F B C D E Select any vertex A Select the shortest edge connected to that vertex AB 3 Prims Algorithm
A F B C D E Select the shortest edge connected to any vertex already connected. AE 4 Prims Algorithm
Select the shortest edge connected to any vertex already connected. ED 2 Prims Algorithm A F B C D E
Select the shortest edge connected to any vertex already connected. DC 4 Prims Algorithm A F B C D E
Select the shortest edge connected to any vertex already connected. EF 5 Prims Algorithm A F B C D E
A F B C D E All vertices have been connected. The solution is AB 3 AE 4 ED 2 DC 4 EF 5 Total weight of tree: 18
Both algorithms will always give solutions with the same length. They will usually select edges in a different order – you must show this in your workings. Occasionally they will use different edges – this may happen when you have to choose between edges with the same length. In this case there is more than one minimum connector for the network. Some points to note
Construction of Prism Algorithm Method II
Construction of Kruskal Algorithm Method II
Mind Map