COIN-OR::LEMON - Graph Library

Changeset 2506:216c6bd5c18c in lemon-0.x


Ignore:
Timestamp:
10/30/07 21:44:53 (16 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@3352
Message:

Change to new union-find interface

Location:
lemon
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • lemon/nagamochi_ibaraki.h

    r2391 r2506  
    13751375      for (typename Ufe::ClassIt c(ufe); c != INVALID; ++c) {
    13761376        if (ufe.size(c) == 1) continue;
     1377        Node cn = ufe.item(c);
    13771378        for (typename Ufe::ItemIt r(ufe, c); r != INVALID; ++r) {
    1378           if (static_cast<Node>(r) == static_cast<Node>(c)) continue;
    1379           _next->set((*_last)[c], (*_first)[r]);
    1380           _last->set(c, (*_last)[r]);
     1379          if (static_cast<Node>(r) == static_cast<Node>(cn)) continue;
     1380          _next->set((*_last)[cn], (*_first)[r]);
     1381          _last->set(cn, (*_last)[r]);
    13811382          remnodes.push_back(r);
    13821383          --_node_num;
     
    13891390      for (typename AuxGraph::UEdgeIt e(*_aux_graph);
    13901391           e != INVALID; ++e) {
    1391         Node sn = ufe.find(_aux_graph->source(e));
    1392         Node tn = ufe.find(_aux_graph->target(e));
    1393         if ((ufe.size(sn) == 1 && ufe.size(tn) == 1)) {
     1392        int sc = ufe.find(_aux_graph->source(e));
     1393        int tc = ufe.find(_aux_graph->target(e));
     1394        if ((ufe.size(sc) == 1 && ufe.size(tc) == 1)) {
    13941395          continue;
    13951396        }
    1396         if (sn == tn) {
     1397        if (sc == tc) {
    13971398          remedges.push_back(e);
    13981399          continue;
    13991400        }
     1401        Node sn = ufe.item(sc);
     1402        Node tn = ufe.item(tc);
     1403
    14001404        EdgeInfo info;
    14011405        if (sn < tn) {
     
    14361440      for (typename Ufe::ClassIt c(ufe); c != INVALID; ++c) {
    14371441        if (ufe.size(c) == 1) continue;
     1442        Node cn = ufe.item(c);
    14381443        Value cutvalue = 0;
    1439         for (typename AuxGraph::IncEdgeIt e(*_aux_graph, c);
     1444        for (typename AuxGraph::IncEdgeIt e(*_aux_graph, cn);
    14401445             e != INVALID; ++e) {
    14411446          cutvalue += (*_aux_capacity)[e];
    14421447        }
    14431448       
    1444         (*_aux_cut_value)[c] = cutvalue;
     1449        (*_aux_cut_value)[cn] = cutvalue;
    14451450       
    14461451      }
  • lemon/unionfind.h

    r2505 r2506  
    475475      }
    476476
    477     }   
     477    }
     478
     479    /// \brief Gives back a representant item of the component.
     480    ///
     481    /// Gives back a representant item of the component.
     482    Item item(int cls) const {
     483      return items[classes[cls].firstItem].item;
     484    }
    478485
    479486    /// \brief Removes the component of the given element from the structure.
     
    733740      return items[index[item]].cls;
    734741    }
     742
     743    /// \brief Gives back a representant item of the component.
     744    ///
     745    /// Gives back a representant item of the component.
     746    Item item(int cls) const {
     747      return items[classes[cls].firstItem].item;
     748    }
    735749   
    736750    /// \brief Removes the given element from the structure.
Note: See TracChangeset for help on using the changeset viewer.