Prim 's minimum spanning tree algorithm