
22 Sep
2006
22 Sep
'06
8:26 a.m.
Hello, in my project i need to compute the maximum spanning tree of an undirected weighted graph. One possible solution is to could iteratively convert each weight wij to 1/wij and apply prim_minimum_spanning_tree algorithm over it. However, i wonder if i could slightly change the prim_minimum_spanning_tree algorithm to a prim_maximum_spanning_tree function by changing only the compare predicate (in line 39 of prim_minimum_spanning_tree.hpp) from std::less<W> compare; to std::greater<W> compare; Wold then the function compute a maximum spanning tree ? Or am i missing something important ?