COIN-OR::LEMON - Graph Library

Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/adaptors.h

    r703 r956  
    33 * This file is a part of LEMON, a generic C++ optimization library.
    44 *
    5  * Copyright (C) 2003-2009
     5 * Copyright (C) 2003-2010
    66 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    77 * (Egervary Research Group on Combinatorial Optimization, EGRES).
     
    361361  /// parameter is set to be \c const.
    362362  ///
     363  /// This class provides item counting in the same time as the adapted
     364  /// digraph structure.
     365  ///
    363366  /// \tparam DGR The type of the adapted digraph.
    364367  /// It must conform to the \ref concepts::Digraph "Digraph" concept.
     
    419422      Parent::initialize(digraph);
    420423      _node_filter = &node_filter;
    421       _arc_filter = &arc_filter;     
     424      _arc_filter = &arc_filter;
    422425    }
    423426
     
    506509
    507510    template <typename V>
    508     class NodeMap 
    509       : public SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>, 
    510               LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> {
     511    class NodeMap
     512      : public SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>,
     513              LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> {
    511514      typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>,
    512         LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> Parent;
     515        LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> Parent;
    513516
    514517    public:
     
    533536
    534537    template <typename V>
    535     class ArcMap 
     538    class ArcMap
    536539      : public SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>,
    537               LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> {
     540              LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> {
    538541      typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>,
    539542        LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> Parent;
     
    580583      Parent::initialize(digraph);
    581584      _node_filter = &node_filter;
    582       _arc_filter = &arc_filter;     
     585      _arc_filter = &arc_filter;
    583586    }
    584587
     
    649652
    650653    template <typename V>
    651     class NodeMap 
     654    class NodeMap
    652655      : public SubMapExtender<SubDigraphBase<DGR, NF, AF, false>,
    653656          LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> {
    654       typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, false>, 
     657      typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, false>,
    655658        LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> Parent;
    656659
     
    676679
    677680    template <typename V>
    678     class ArcMap 
     681    class ArcMap
    679682      : public SubMapExtender<SubDigraphBase<DGR, NF, AF, false>,
    680683          LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> {
     
    719722  /// by adding or removing nodes or arcs, unless the \c GR template
    720723  /// parameter is set to be \c const.
     724  ///
     725  /// This class provides only linear time counting for nodes and arcs.
    721726  ///
    722727  /// \tparam DGR The type of the adapted digraph.
     
    10171022
    10181023    template <typename V>
    1019     class NodeMap 
     1024    class NodeMap
    10201025      : public SubMapExtender<SubGraphBase<GR, NF, EF, ch>,
    10211026          LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> {
    1022       typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 
     1027      typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>,
    10231028        LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> Parent;
    10241029
     
    10441049
    10451050    template <typename V>
    1046     class ArcMap 
     1051    class ArcMap
    10471052      : public SubMapExtender<SubGraphBase<GR, NF, EF, ch>,
    10481053          LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> {
    1049       typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 
     1054      typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>,
    10501055        LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> Parent;
    10511056
     
    10711076
    10721077    template <typename V>
    1073     class EdgeMap 
     1078    class EdgeMap
    10741079      : public SubMapExtender<SubGraphBase<GR, NF, EF, ch>,
    10751080        LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> {
    1076       typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 
     1081      typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>,
    10771082        LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> Parent;
    10781083
     
    11131118    NF* _node_filter;
    11141119    EF* _edge_filter;
    1115     SubGraphBase() 
    1116           : Parent(), _node_filter(0), _edge_filter(0) { }
     1120    SubGraphBase()
     1121          : Parent(), _node_filter(0), _edge_filter(0) { }
    11171122
    11181123    void initialize(GR& graph, NF& node_filter, EF& edge_filter) {
     
    12151220
    12161221    template <typename V>
    1217     class NodeMap 
     1222    class NodeMap
    12181223      : public SubMapExtender<SubGraphBase<GR, NF, EF, false>,
    12191224          LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> {
    1220       typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>, 
     1225      typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>,
    12211226        LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> Parent;
    12221227
     
    12421247
    12431248    template <typename V>
    1244     class ArcMap 
     1249    class ArcMap
    12451250      : public SubMapExtender<SubGraphBase<GR, NF, EF, false>,
    12461251          LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> {
    1247       typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>, 
     1252      typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>,
    12481253        LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> Parent;
    12491254
     
    12691274
    12701275    template <typename V>
    1271     class EdgeMap 
     1276    class EdgeMap
    12721277      : public SubMapExtender<SubGraphBase<GR, NF, EF, false>,
    12731278        LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> {
    1274       typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>, 
    1275         LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> Parent;
     1279      typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>,
     1280        LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> Parent;
    12761281
    12771282    public:
     
    13141319  /// by adding or removing nodes or edges, unless the \c GR template
    13151320  /// parameter is set to be \c const.
     1321  ///
     1322  /// This class provides only linear time counting for nodes, edges and arcs.
    13161323  ///
    13171324  /// \tparam GR The type of the adapted graph.
     
    14711478  /// by adding or removing nodes or arcs/edges, unless the \c GR template
    14721479  /// parameter is set to be \c const.
     1480  ///
     1481  /// This class provides only linear time item counting.
    14731482  ///
    14741483  /// \tparam GR The type of the adapted digraph or graph.
     
    14961505#endif
    14971506    typedef DigraphAdaptorExtender<
    1498       SubDigraphBase<GR, NF, ConstMap<typename GR::Arc, Const<bool, true> >, 
     1507      SubDigraphBase<GR, NF, ConstMap<typename GR::Arc, Const<bool, true> >,
    14991508                     true> > Parent;
    15001509
     
    15171526    /// Creates a subgraph for the given digraph or graph with the
    15181527    /// given node filter map.
    1519     FilterNodes(GR& graph, NF& node_filter) 
     1528    FilterNodes(GR& graph, NF& node_filter)
    15201529      : Parent(), const_true_map()
    15211530    {
     
    15551564                    typename enable_if<UndirectedTagIndicator<GR> >::type> :
    15561565    public GraphAdaptorExtender<
    1557       SubGraphBase<GR, NF, ConstMap<typename GR::Edge, Const<bool, true> >, 
     1566      SubGraphBase<GR, NF, ConstMap<typename GR::Edge, Const<bool, true> >,
    15581567                   true> > {
    15591568
    15601569    typedef GraphAdaptorExtender<
    1561       SubGraphBase<GR, NF, ConstMap<typename GR::Edge, Const<bool, true> >, 
     1570      SubGraphBase<GR, NF, ConstMap<typename GR::Edge, Const<bool, true> >,
    15621571                   true> > Parent;
    15631572
     
    16191628  /// by adding or removing nodes or arcs, unless the \c GR template
    16201629  /// parameter is set to be \c const.
     1630  ///
     1631  /// This class provides only linear time counting for nodes and arcs.
    16211632  ///
    16221633  /// \tparam DGR The type of the adapted digraph.
     
    16431654#endif
    16441655    typedef DigraphAdaptorExtender<
    1645       SubDigraphBase<DGR, ConstMap<typename DGR::Node, Const<bool, true> >, 
     1656      SubDigraphBase<DGR, ConstMap<typename DGR::Node, Const<bool, true> >,
    16461657                     AF, false> > Parent;
    16471658
     
    17291740  /// by adding or removing nodes or edges, unless the \c GR template
    17301741  /// parameter is set to be \c const.
     1742  ///
     1743  /// This class provides only linear time counting for nodes, edges and arcs.
    17311744  ///
    17321745  /// \tparam GR The type of the adapted graph.
     
    17491762  class FilterEdges :
    17501763    public GraphAdaptorExtender<
    1751       SubGraphBase<GR, ConstMap<typename GR::Node, Const<bool, true> >, 
     1764      SubGraphBase<GR, ConstMap<typename GR::Node, Const<bool, true> >,
    17521765                   EF, false> > {
    17531766#endif
    17541767    typedef GraphAdaptorExtender<
    1755       SubGraphBase<GR, ConstMap<typename GR::Node, Const<bool, true > >, 
     1768      SubGraphBase<GR, ConstMap<typename GR::Node, Const<bool, true > >,
    17561769                   EF, false> > Parent;
    17571770
     
    17781791    /// Creates a subgraph for the given graph with the given edge
    17791792    /// filter map.
    1780     FilterEdges(GR& graph, EF& edge_filter) 
     1793    FilterEdges(GR& graph, EF& edge_filter)
    17811794      : Parent(), const_true_map() {
    17821795      Parent::initialize(graph, const_true_map, edge_filter);
     
    18461859      bool _forward;
    18471860
    1848       Arc(const Edge& edge, bool forward) 
     1861      Arc(const Edge& edge, bool forward)
    18491862        : _edge(edge), _forward(forward) {}
    18501863
     
    20862099
    20872100      ArcMapBase(const UndirectorBase<DGR>& adaptor, const V& value)
    2088         : _forward(*adaptor._digraph, value), 
     2101        : _forward(*adaptor._digraph, value),
    20892102          _backward(*adaptor._digraph, value) {}
    20902103
     
    22042217    typedef typename ItemSetTraits<DGR, Edge>::ItemNotifier EdgeNotifier;
    22052218    EdgeNotifier& notifier(Edge) const { return _digraph->notifier(Edge()); }
    2206    
     2219
    22072220    typedef EdgeNotifier ArcNotifier;
    22082221    ArcNotifier& notifier(Arc) const { return _digraph->notifier(Edge()); }
     
    22322245  /// by adding or removing nodes or edges, unless the \c GR template
    22332246  /// parameter is set to be \c const.
     2247  ///
     2248  /// This class provides item counting in the same time as the adapted
     2249  /// digraph structure.
    22342250  ///
    22352251  /// \tparam DGR The type of the adapted digraph.
     
    25352551  /// by adding or removing nodes or arcs, unless the \c GR template
    25362552  /// parameter is set to be \c const.
     2553  ///
     2554  /// This class provides item counting in the same time as the adapted
     2555  /// graph structure.
    25372556  ///
    25382557  /// \tparam GR The type of the adapted graph.
     
    26792698  /// This class conforms to the \ref concepts::Digraph "Digraph" concept.
    26802699  ///
     2700  /// This class provides only linear time counting for nodes and arcs.
     2701  ///
    26812702  /// \tparam DGR The type of the adapted digraph.
    26822703  /// It must conform to the \ref concepts::Digraph "Digraph" concept.
     
    27082729           typename FM = CM,
    27092730           typename TL = Tolerance<typename CM::Value> >
    2710   class ResidualDigraph 
     2731  class ResidualDigraph
    27112732    : public SubDigraph<
    27122733        Undirector<const DGR>,
     
    27652786    ResidualDigraph(const DGR& digraph, const CM& capacity,
    27662787                    FM& flow, const TL& tolerance = Tolerance())
    2767       : Parent(), _capacity(&capacity), _flow(&flow), 
     2788      : Parent(), _capacity(&capacity), _flow(&flow),
    27682789        _graph(digraph), _node_filter(),
    27692790        _forward_filter(capacity, flow, tolerance),
     
    28472868
    28482869      /// Constructor
    2849       ResidualCapacity(const ResidualDigraph<DGR, CM, FM, TL>& adaptor) 
     2870      ResidualCapacity(const ResidualDigraph<DGR, CM, FM, TL>& adaptor)
    28502871        : _adaptor(&adaptor) {}
    28512872
     
    33263347  /// in the adaptor.
    33273348  ///
     3349  /// This class provides item counting in the same time as the adapted
     3350  /// digraph structure.
     3351  ///
    33283352  /// \tparam DGR The type of the adapted digraph.
    33293353  /// It must conform to the \ref concepts::Digraph "Digraph" concept.
     
    34243448    /// to get a node map of the split digraph.
    34253449    /// Its value type is inherited from the first node map type (\c IN).
    3426     /// \tparam IN The type of the node map for the in-nodes. 
     3450    /// \tparam IN The type of the node map for the in-nodes.
    34273451    /// \tparam OUT The type of the node map for the out-nodes.
    34283452    template <typename IN, typename OUT>
Note: See TracChangeset for help on using the changeset viewer.