add WeightedEdge type and revised Prim