lemon/nagamochi_ibaraki.h
changeset 2506 216c6bd5c18c
parent 2391 14a343be7a5a
child 2530 f86f7e4eb2ba
     1.1 --- a/lemon/nagamochi_ibaraki.h	Tue Oct 30 20:21:10 2007 +0000
     1.2 +++ b/lemon/nagamochi_ibaraki.h	Tue Oct 30 20:44:53 2007 +0000
     1.3 @@ -1374,10 +1374,11 @@
     1.4        typename AuxGraph::template NodeMap<UEdge> edges(*_aux_graph, INVALID);
     1.5        for (typename Ufe::ClassIt c(ufe); c != INVALID; ++c) {
     1.6          if (ufe.size(c) == 1) continue;
     1.7 +	Node cn = ufe.item(c);
     1.8          for (typename Ufe::ItemIt r(ufe, c); r != INVALID; ++r) {
     1.9 -          if (static_cast<Node>(r) == static_cast<Node>(c)) continue;
    1.10 -          _next->set((*_last)[c], (*_first)[r]);
    1.11 -          _last->set(c, (*_last)[r]);
    1.12 +          if (static_cast<Node>(r) == static_cast<Node>(cn)) continue;
    1.13 +          _next->set((*_last)[cn], (*_first)[r]);
    1.14 +          _last->set(cn, (*_last)[r]);
    1.15            remnodes.push_back(r);
    1.16            --_node_num;
    1.17          }
    1.18 @@ -1388,15 +1389,18 @@
    1.19  
    1.20        for (typename AuxGraph::UEdgeIt e(*_aux_graph);
    1.21             e != INVALID; ++e) {
    1.22 -        Node sn = ufe.find(_aux_graph->source(e));
    1.23 -        Node tn = ufe.find(_aux_graph->target(e));
    1.24 -        if ((ufe.size(sn) == 1 && ufe.size(tn) == 1)) {
    1.25 +	int sc = ufe.find(_aux_graph->source(e));
    1.26 +	int tc = ufe.find(_aux_graph->target(e));
    1.27 +        if ((ufe.size(sc) == 1 && ufe.size(tc) == 1)) {
    1.28            continue;
    1.29          }
    1.30 -        if (sn == tn) {
    1.31 +        if (sc == tc) {
    1.32            remedges.push_back(e);
    1.33            continue;
    1.34          }
    1.35 +        Node sn = ufe.item(sc);
    1.36 +        Node tn = ufe.item(tc);
    1.37 +
    1.38          EdgeInfo info;
    1.39          if (sn < tn) {
    1.40            info.source = sn;
    1.41 @@ -1435,13 +1439,14 @@
    1.42  
    1.43        for (typename Ufe::ClassIt c(ufe); c != INVALID; ++c) {
    1.44          if (ufe.size(c) == 1) continue;
    1.45 +	Node cn = ufe.item(c);
    1.46          Value cutvalue = 0;
    1.47 -        for (typename AuxGraph::IncEdgeIt e(*_aux_graph, c);
    1.48 +        for (typename AuxGraph::IncEdgeIt e(*_aux_graph, cn);
    1.49               e != INVALID; ++e) {
    1.50            cutvalue += (*_aux_capacity)[e];
    1.51          }
    1.52          
    1.53 -        (*_aux_cut_value)[c] = cutvalue;
    1.54 +        (*_aux_cut_value)[cn] = cutvalue;
    1.55          
    1.56        }
    1.57