Prims algorithm to implement minimum spanning tree based on a minimum priority heap.