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
2.1 --- a/lemon/unionfind.h Tue Oct 30 20:21:10 2007 +0000
2.2 +++ b/lemon/unionfind.h Tue Oct 30 20:44:53 2007 +0000
2.3 @@ -474,7 +474,14 @@
2.4
2.5 }
2.6
2.7 - }
2.8 + }
2.9 +
2.10 + /// \brief Gives back a representant item of the component.
2.11 + ///
2.12 + /// Gives back a representant item of the component.
2.13 + Item item(int cls) const {
2.14 + return items[classes[cls].firstItem].item;
2.15 + }
2.16
2.17 /// \brief Removes the component of the given element from the structure.
2.18 ///
2.19 @@ -732,6 +739,13 @@
2.20 int find(const Item &item) const {
2.21 return items[index[item]].cls;
2.22 }
2.23 +
2.24 + /// \brief Gives back a representant item of the component.
2.25 + ///
2.26 + /// Gives back a representant item of the component.
2.27 + Item item(int cls) const {
2.28 + return items[classes[cls].firstItem].item;
2.29 + }
2.30
2.31 /// \brief Removes the given element from the structure.
2.32 ///