Reputation: 13
I am currently working with the BGL using
prim_minimum_spanning_tree(g, parent.data());
However, my Graph does contain edges with negative weights. This results in following Error
terminate called after throwing an instance of 'boost::wrapexcept<boost::negative_edge>'
what(): The graph may not contain an edge with negative weight.
This seems kind of strange to me since Prim's algorithm works perfectly fine with negative edge weights. How come that this is still a problem for BGL? Also, what would be the easiest way to fix this problem? Do I have to add a constant on all edge's weight to make them all positive or is this avoidable? Thank you in advance.
Upvotes: 0
Views: 255