diff -r 6c1ac149ebf8 -r 1229dc2f1d36 lemon/unionfind.h --- a/lemon/unionfind.h Sun Dec 21 00:16:46 2008 +0100 +++ b/lemon/unionfind.h Sun Dec 21 20:47:15 2008 +0100 @@ -1177,7 +1177,8 @@ int pd = nodes[jd].parent; if (nodes[nodes[jd].next].size < cmax) { pushLeft(nodes[jd].next, nodes[jd].left); - if (nodes[jd].item == nodes[pd].item) { + if (less(jd, nodes[jd].next) || + nodes[jd].item == nodes[pd].item) { nodes[nodes[jd].next].prio = nodes[jd].prio; nodes[nodes[jd].next].item = nodes[jd].item; } @@ -1220,7 +1221,8 @@ int pd = nodes[jd].parent; if (nodes[nodes[jd].prev].size < cmax) { pushRight(nodes[jd].prev, nodes[jd].right); - if (nodes[jd].item == nodes[pd].item) { + if (less(jd, nodes[jd].prev) || + nodes[jd].item == nodes[pd].item) { nodes[nodes[jd].prev].prio = nodes[jd].prio; nodes[nodes[jd].prev].item = nodes[jd].item; } @@ -1253,11 +1255,6 @@ return comp(nodes[id].prio, nodes[jd].prio); } - bool equal(int id, int jd) const { - return !less(id, jd) && !less(jd, id); - } - - public: /// \brief Returns true when the given class is alive.