diff -r bb022b8f9c8f -r 1cc2818c03c0 lemon/unionfind.h --- a/lemon/unionfind.h Sun Dec 21 00:15:08 2008 +0100 +++ b/lemon/unionfind.h Sun Dec 21 20:46:35 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.