Backport hg commit [81d40f1c850c] (ticket #197)
authordeba
Sun, 21 Dec 2008 20:13:28 +0000
changeset 2632511cf2518a32
parent 2631 212ea31bf6b9
child 2633 4f47c0f6be04
Backport hg commit [81d40f1c850c] (ticket #197)
lemon/unionfind.h
     1.1 --- a/lemon/unionfind.h	Sat Dec 20 22:45:48 2008 +0000
     1.2 +++ b/lemon/unionfind.h	Sun Dec 21 20:13:28 2008 +0000
     1.3 @@ -1177,7 +1177,8 @@
     1.4  	    int pd = nodes[jd].parent;
     1.5  	    if (nodes[nodes[jd].next].size < cmax) {
     1.6  	      pushLeft(nodes[jd].next, nodes[jd].left);
     1.7 -              if (nodes[jd].item == nodes[pd].item) {
     1.8 +              if (less(jd, nodes[jd].next) ||
     1.9 +		  nodes[jd].item == nodes[pd].item) {
    1.10                  nodes[nodes[jd].next].prio = nodes[jd].prio;
    1.11                  nodes[nodes[jd].next].item = nodes[jd].item;
    1.12  	      }
    1.13 @@ -1220,7 +1221,8 @@
    1.14  	    int pd = nodes[jd].parent;
    1.15  	    if (nodes[nodes[jd].prev].size < cmax) {
    1.16  	      pushRight(nodes[jd].prev, nodes[jd].right);
    1.17 -              if (nodes[jd].item == nodes[pd].item) {
    1.18 +              if (less(jd, nodes[jd].prev) ||
    1.19 +		  nodes[jd].item == nodes[pd].item) {
    1.20                  nodes[nodes[jd].prev].prio = nodes[jd].prio;
    1.21                  nodes[nodes[jd].prev].item = nodes[jd].item;
    1.22  	      }