Implemented PrimMinimumSpanningTree() method.