lemon/capacity_scaling.h
changeset 2507 6520edb2c3f3
parent 2471 ed70b226cc48
child 2509 a8081c9cd96a
equal deleted inserted replaced
2:3344b33ec282 3:e639cb4baa65
   362 	Supply s = _supply[n];
   362 	Supply s = _supply[n];
   363 	for (InEdgeIt e(graph, n); e != INVALID; ++e)
   363 	for (InEdgeIt e(graph, n); e != INVALID; ++e)
   364 	  s += _lower[e];
   364 	  s += _lower[e];
   365 	for (OutEdgeIt e(graph, n); e != INVALID; ++e)
   365 	for (OutEdgeIt e(graph, n); e != INVALID; ++e)
   366 	  s -= _lower[e];
   366 	  s -= _lower[e];
   367 	supply[n] = imbalance[n] = s;
   367 	supply[n] = s;
   368 	sum += s;
   368 	sum += s;
   369       }
   369       }
   370       valid_supply = sum == 0;
   370       valid_supply = sum == 0;
   371     }
   371     }
   372 
   372 
   443 	if (n == _t) s = -_flow_value;
   443 	if (n == _t) s = -_flow_value;
   444 	for (InEdgeIt e(graph, n); e != INVALID; ++e)
   444 	for (InEdgeIt e(graph, n); e != INVALID; ++e)
   445 	  s += _lower[e];
   445 	  s += _lower[e];
   446 	for (OutEdgeIt e(graph, n); e != INVALID; ++e)
   446 	for (OutEdgeIt e(graph, n); e != INVALID; ++e)
   447 	  s -= _lower[e];
   447 	  s -= _lower[e];
   448 	supply[n] = imbalance[n] = s;
   448 	supply[n] = s;
   449       }
   449       }
   450       valid_supply = true;
   450       valid_supply = true;
   451     }
   451     }
   452 
   452 
   453     /// \brief Simple constructor of the class (without lower bounds).
   453     /// \brief Simple constructor of the class (without lower bounds).
   531   protected:
   531   protected:
   532 
   532 
   533     /// \brief Initializes the algorithm.
   533     /// \brief Initializes the algorithm.
   534     bool init() {
   534     bool init() {
   535       if (!valid_supply) return false;
   535       if (!valid_supply) return false;
       
   536       imbalance = supply;
   536 
   537 
   537       // Initalizing Dijkstra class
   538       // Initalizing Dijkstra class
   538       updater.potentialMap(potential);
   539       updater.potentialMap(potential);
   539       dijkstra.distMap(updater).predMap(pred);
   540       dijkstra.distMap(updater).predMap(pred);
   540 
   541