Your kingdom is composed of 8 walled cities, which are connected by roads, tunnels, and other various pathways. There may be redundant connections between the cities, and there are even some odd paths that simply go from a city back to itself.
An earthquake has occurred, and all roads, tunnels and paths have been destroyed. Each has a rebuilding cost which has been reported to you in the manifest below. You want to rebuild the minimum number of paths/roads/tunnels to connect all of the cities, and you want to do that with minimum cost. What is that minimum cost?
You should use Kruskal’s algorithm here. Trust me.