Prim's minimum spanning tree