Finding the minimum spanning tree using Prims Algorithm