Allow negative weights in Prim's algorithm.