[Lemon-commits] Balazs Dezso: Merge bugfix #197

Lemon HG hg at lemon.cs.elte.hu
Mon Dec 22 23:25:58 CET 2008


details:   http://lemon.cs.elte.hu/hg/lemon/rev/1229dc2f1d36
changeset: 461:1229dc2f1d36
user:      Balazs Dezso <deba [at] inf.elte.hu>
date:      Sun Dec 21 20:47:15 2008 +0100
description:
	Merge bugfix #197

diffstat:

1 file changed, 4 insertions(+), 7 deletions(-)
lemon/unionfind.h |   11 ++++-------

diffs (35 lines):

diff --git a/lemon/unionfind.h b/lemon/unionfind.h
--- a/lemon/unionfind.h
+++ b/lemon/unionfind.h
@@ -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.



More information about the Lemon-commits mailing list