modify of PrimsMST