Small bug fix.
authorkpeter
Wed, 07 Nov 2007 21:52:57 +0000
changeset 25076520edb2c3f3
parent 2506 216c6bd5c18c
child 2508 c86db0f7f917
Small bug fix.
lemon/capacity_scaling.h
lemon/min_cost_max_flow.h
     1.1 --- a/lemon/capacity_scaling.h	Tue Oct 30 20:44:53 2007 +0000
     1.2 +++ b/lemon/capacity_scaling.h	Wed Nov 07 21:52:57 2007 +0000
     1.3 @@ -364,7 +364,7 @@
     1.4  	  s += _lower[e];
     1.5  	for (OutEdgeIt e(graph, n); e != INVALID; ++e)
     1.6  	  s -= _lower[e];
     1.7 -	supply[n] = imbalance[n] = s;
     1.8 +	supply[n] = s;
     1.9  	sum += s;
    1.10        }
    1.11        valid_supply = sum == 0;
    1.12 @@ -445,7 +445,7 @@
    1.13  	  s += _lower[e];
    1.14  	for (OutEdgeIt e(graph, n); e != INVALID; ++e)
    1.15  	  s -= _lower[e];
    1.16 -	supply[n] = imbalance[n] = s;
    1.17 +	supply[n] = s;
    1.18        }
    1.19        valid_supply = true;
    1.20      }
    1.21 @@ -533,6 +533,7 @@
    1.22      /// \brief Initializes the algorithm.
    1.23      bool init() {
    1.24        if (!valid_supply) return false;
    1.25 +      imbalance = supply;
    1.26  
    1.27        // Initalizing Dijkstra class
    1.28        updater.potentialMap(potential);
     2.1 --- a/lemon/min_cost_max_flow.h	Tue Oct 30 20:44:53 2007 +0000
     2.2 +++ b/lemon/min_cost_max_flow.h	Wed Nov 07 21:52:57 2007 +0000
     2.3 @@ -75,6 +75,7 @@
     2.4  
     2.5      /// \brief The type of the flow map.
     2.6      typedef typename Graph::template EdgeMap<Capacity> FlowMap;
     2.7 +    typedef typename CostMap::Value Cost;
     2.8  
     2.9    private:
    2.10  
    2.11 @@ -133,7 +134,7 @@
    2.12      /// \pre \ref run() must be called before using this function.
    2.13      Cost totalCost() const {
    2.14        Cost c = 0;
    2.15 -      for (EdgeIt e(graph); e != INVALID; ++e)
    2.16 +      for (typename Graph::EdgeIt e(graph); e != INVALID; ++e)
    2.17  	c += flow[e] * cost[e];
    2.18        return c;
    2.19      }