What’s the cheapest way to link five GAA grounds with a fibre network?
Five GAA grounds in Clare want to share a fibre network. Each possible link has a price. If you start at one ground and add links one at a time, how can you connect all five for the lowest total cost?
In a connected network, you can get from any site to any other. If it has no cycles, it’s a tree. A spanning tree includes every vertex of the original network. A minimum spanning tree has the lowest total weight of all its spanning trees.
Start at A. Its cheapest link goes to B, so A B is the solid line. The rings mark A and B as reached. Now compare the links with one end inside the reached set and one end outside it. Prim’s algorithm chooses the cheapest of those links.
A and B are reached. C and D are still outside. Which link is the cheapest one that crosses from the reached set to an unreached site? Pick the next link.
Here are the possible fibre links between the five grounds. Start with A, the only site ringed as reached. The weights are costs in thousands of euro, so the first choice is between A B at three thousand and A C at five thousand.
The blue letters show which sites you’ve reached. From A, take A B for three. Then A C costs five, less than either link out of B to an unreached site. Now C D is eligible at two. Take D E for four. All sites are reached, for fourteen thousand euro.
Start at A in this four-site network. Update your reached set after each choice. Which option gives the completed tree, with its edges in the order Prim’s algorithm chooses them and the correct total weight? Pick one.
After choosing A B in Clare, you’ve just reached B. If you look only from B to unreached sites, you’d pick B D for six. But A is still in the reached set, and A C crosses to an unreached site for five. Choose A C.
Prim starts at A and grows one tree. Kruskal needs no starting vertex. It takes edges from cheapest up, skipping any that would make a cycle. Here it takes C D, A B, D E, then A C. Both methods finish with the same tree in this example.