lemon/unionfind.h
changeset 492 b9b3473327e3
parent 438 81d40f1c850c
child 559 c5fd2d996909
equal deleted inserted replaced
5:839107f01407 6:afe1068aba23
     1 /* -*- mode: C++; indent-tabs-mode: nil; -*-
     1 /* -*- mode: C++; indent-tabs-mode: nil; -*-
     2  *
     2  *
     3  * This file is a part of LEMON, a generic C++ optimization library.
     3  * This file is a part of LEMON, a generic C++ optimization library.
     4  *
     4  *
     5  * Copyright (C) 2003-2008
     5  * Copyright (C) 2003-2009
     6  * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     6  * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     7  * (Egervary Research Group on Combinatorial Optimization, EGRES).
     7  * (Egervary Research Group on Combinatorial Optimization, EGRES).
     8  *
     8  *
     9  * Permission to use, modify and distribute this software is granted
     9  * Permission to use, modify and distribute this software is granted
    10  * provided that this copyright notice appears in all copies. For
    10  * provided that this copyright notice appears in all copies. For
  1187               jd = pd;
  1187               jd = pd;
  1188             } else {
  1188             } else {
  1189               int ld = nodes[nodes[jd].next].left;
  1189               int ld = nodes[nodes[jd].next].left;
  1190               popLeft(nodes[jd].next);
  1190               popLeft(nodes[jd].next);
  1191               pushRight(jd, ld);
  1191               pushRight(jd, ld);
  1192               if (less(ld, nodes[jd].left) || 
  1192               if (less(ld, nodes[jd].left) ||
  1193                   nodes[ld].item == nodes[pd].item) {
  1193                   nodes[ld].item == nodes[pd].item) {
  1194                 nodes[jd].item = nodes[ld].item;
  1194                 nodes[jd].item = nodes[ld].item;
  1195                 nodes[jd].prio = nodes[ld].prio;
  1195                 nodes[jd].prio = nodes[ld].prio;
  1196               }
  1196               }
  1197               if (nodes[nodes[jd].next].item == nodes[ld].item) {
  1197               if (nodes[nodes[jd].next].item == nodes[ld].item) {