Prim minimum spanning tree