lemon/circulation.h
changeset 598 a3402913cffe
parent 503 9605e051942f
child 581 aa1804409f29
equal deleted inserted replaced
5:89a6d2e45da2 6:dfc6436fbb5a
   213 
   213 
   214     ///\name Named Template Parameters
   214     ///\name Named Template Parameters
   215 
   215 
   216     ///@{
   216     ///@{
   217 
   217 
   218     template <typename _FlowMap>
   218     template <typename T>
   219     struct SetFlowMapTraits : public Traits {
   219     struct SetFlowMapTraits : public Traits {
   220       typedef _FlowMap FlowMap;
   220       typedef T FlowMap;
   221       static FlowMap *createFlowMap(const Digraph&) {
   221       static FlowMap *createFlowMap(const Digraph&) {
   222         LEMON_ASSERT(false, "FlowMap is not initialized");
   222         LEMON_ASSERT(false, "FlowMap is not initialized");
   223         return 0; // ignore warnings
   223         return 0; // ignore warnings
   224       }
   224       }
   225     };
   225     };
   227     /// \brief \ref named-templ-param "Named parameter" for setting
   227     /// \brief \ref named-templ-param "Named parameter" for setting
   228     /// FlowMap type
   228     /// FlowMap type
   229     ///
   229     ///
   230     /// \ref named-templ-param "Named parameter" for setting FlowMap
   230     /// \ref named-templ-param "Named parameter" for setting FlowMap
   231     /// type.
   231     /// type.
   232     template <typename _FlowMap>
   232     template <typename T>
   233     struct SetFlowMap
   233     struct SetFlowMap
   234       : public Circulation<Digraph, LCapMap, UCapMap, DeltaMap,
   234       : public Circulation<Digraph, LCapMap, UCapMap, DeltaMap,
   235                            SetFlowMapTraits<_FlowMap> > {
   235                            SetFlowMapTraits<T> > {
   236       typedef Circulation<Digraph, LCapMap, UCapMap, DeltaMap,
   236       typedef Circulation<Digraph, LCapMap, UCapMap, DeltaMap,
   237                           SetFlowMapTraits<_FlowMap> > Create;
   237                           SetFlowMapTraits<T> > Create;
   238     };
   238     };
   239 
   239 
   240     template <typename _Elevator>
   240     template <typename T>
   241     struct SetElevatorTraits : public Traits {
   241     struct SetElevatorTraits : public Traits {
   242       typedef _Elevator Elevator;
   242       typedef T Elevator;
   243       static Elevator *createElevator(const Digraph&, int) {
   243       static Elevator *createElevator(const Digraph&, int) {
   244         LEMON_ASSERT(false, "Elevator is not initialized");
   244         LEMON_ASSERT(false, "Elevator is not initialized");
   245         return 0; // ignore warnings
   245         return 0; // ignore warnings
   246       }
   246       }
   247     };
   247     };
   253     /// type. If this named parameter is used, then an external
   253     /// type. If this named parameter is used, then an external
   254     /// elevator object must be passed to the algorithm using the
   254     /// elevator object must be passed to the algorithm using the
   255     /// \ref elevator(Elevator&) "elevator()" function before calling
   255     /// \ref elevator(Elevator&) "elevator()" function before calling
   256     /// \ref run() or \ref init().
   256     /// \ref run() or \ref init().
   257     /// \sa SetStandardElevator
   257     /// \sa SetStandardElevator
   258     template <typename _Elevator>
   258     template <typename T>
   259     struct SetElevator
   259     struct SetElevator
   260       : public Circulation<Digraph, LCapMap, UCapMap, DeltaMap,
   260       : public Circulation<Digraph, LCapMap, UCapMap, DeltaMap,
   261                            SetElevatorTraits<_Elevator> > {
   261                            SetElevatorTraits<T> > {
   262       typedef Circulation<Digraph, LCapMap, UCapMap, DeltaMap,
   262       typedef Circulation<Digraph, LCapMap, UCapMap, DeltaMap,
   263                           SetElevatorTraits<_Elevator> > Create;
   263                           SetElevatorTraits<T> > Create;
   264     };
   264     };
   265 
   265 
   266     template <typename _Elevator>
   266     template <typename T>
   267     struct SetStandardElevatorTraits : public Traits {
   267     struct SetStandardElevatorTraits : public Traits {
   268       typedef _Elevator Elevator;
   268       typedef T Elevator;
   269       static Elevator *createElevator(const Digraph& digraph, int max_level) {
   269       static Elevator *createElevator(const Digraph& digraph, int max_level) {
   270         return new Elevator(digraph, max_level);
   270         return new Elevator(digraph, max_level);
   271       }
   271       }
   272     };
   272     };
   273 
   273 
   281     /// digraph and the maximum level should be passed to it).
   281     /// digraph and the maximum level should be passed to it).
   282     /// However an external elevator object could also be passed to the
   282     /// However an external elevator object could also be passed to the
   283     /// algorithm with the \ref elevator(Elevator&) "elevator()" function
   283     /// algorithm with the \ref elevator(Elevator&) "elevator()" function
   284     /// before calling \ref run() or \ref init().
   284     /// before calling \ref run() or \ref init().
   285     /// \sa SetElevator
   285     /// \sa SetElevator
   286     template <typename _Elevator>
   286     template <typename T>
   287     struct SetStandardElevator
   287     struct SetStandardElevator
   288       : public Circulation<Digraph, LCapMap, UCapMap, DeltaMap,
   288       : public Circulation<Digraph, LCapMap, UCapMap, DeltaMap,
   289                        SetStandardElevatorTraits<_Elevator> > {
   289                        SetStandardElevatorTraits<T> > {
   290       typedef Circulation<Digraph, LCapMap, UCapMap, DeltaMap,
   290       typedef Circulation<Digraph, LCapMap, UCapMap, DeltaMap,
   291                       SetStandardElevatorTraits<_Elevator> > Create;
   291                       SetStandardElevatorTraits<T> > Create;
   292     };
   292     };
   293 
   293 
   294     /// @}
   294     /// @}
   295 
   295 
   296   protected:
   296   protected:
   680     ///
   680     ///
   681     /// If a feasible circulation is found, the function gives back an
   681     /// If a feasible circulation is found, the function gives back an
   682     /// empty set, so \c bar[v] will be \c false for all nodes \c v.
   682     /// empty set, so \c bar[v] will be \c false for all nodes \c v.
   683     ///
   683     ///
   684     /// \note This function calls \ref barrier() for each node,
   684     /// \note This function calls \ref barrier() for each node,
   685     /// so it runs in \f$O(n)\f$ time.
   685     /// so it runs in O(n) time.
   686     ///
   686     ///
   687     /// \pre Either \ref run() or \ref init() must be called before
   687     /// \pre Either \ref run() or \ref init() must be called before
   688     /// using this function.
   688     /// using this function.
   689     ///
   689     ///
   690     /// \sa barrier()
   690     /// \sa barrier()