Added the prim mst code