lemon/min_cost_max_flow.h
changeset 2582 4f1ac622bb7a
parent 2579 691ce54544c5
child 2587 061be2e64eca
equal deleted inserted replaced
7:b22503a16f38 8:e6093f5eb39d
    52   /// \tparam CapacityMap The type of the capacity (upper bound) map.
    52   /// \tparam CapacityMap The type of the capacity (upper bound) map.
    53   /// \tparam CostMap The type of the cost (length) map.
    53   /// \tparam CostMap The type of the cost (length) map.
    54   ///
    54   ///
    55   /// \warning
    55   /// \warning
    56   /// - Edge capacities and costs should be \e non-negative \e integers.
    56   /// - Edge capacities and costs should be \e non-negative \e integers.
    57   ///   However \c CostMap::Value must be signed type.
       
    58   /// - \c CapacityMap::Value must be convertible to \c CostMap::Value.
    57   /// - \c CapacityMap::Value must be convertible to \c CostMap::Value.
       
    58   /// - \c CostMap::Value must be signed type.
    59   ///
    59   ///
    60   /// \author Peter Kovacs
    60   /// \author Peter Kovacs
    61 
    61 
    62   template < typename Graph,
    62   template < typename Graph,
    63              typename CapacityMap = typename Graph::template EdgeMap<int>,
    63              typename CapacityMap = typename Graph::template EdgeMap<int>,
   126     void run() {
   126     void run() {
   127       MaxFlowImpl preflow(_graph, _capacity, _source, _target);
   127       MaxFlowImpl preflow(_graph, _capacity, _source, _target);
   128       preflow.flowMap(_flow).runMinCut();
   128       preflow.flowMap(_flow).runMinCut();
   129       MinCostFlowImpl mcf( _graph, _capacity, _cost,
   129       MinCostFlowImpl mcf( _graph, _capacity, _cost,
   130                            _source, _target, preflow.flowValue() );
   130                            _source, _target, preflow.flowValue() );
   131       mcf.run();
   131       mcf.flowMap(_flow).potentialMap(_potential).run();
   132       _flow = mcf.flowMap();
       
   133       _potential = mcf.potentialMap();
       
   134     }
   132     }
   135 
   133 
   136     /// \brief Returns a const reference to the edge map storing the
   134     /// \brief Returns a const reference to the edge map storing the
   137     /// found flow.
   135     /// found flow.
   138     ///
   136     ///