lemon/adaptors.h
changeset 877 141f9c0db4a3
parent 787 c2230649a493
child 964 7fdaa05a69a1
equal deleted inserted replaced
20:fce95d786b7d 21:573f77431e68
     1 /* -*- mode: C++; indent-tabs-mode: nil; -*-
     1 /* -*- mode: C++; indent-tabs-mode: nil; -*-
     2  *
     2  *
     3  * This file is a part of LEMON, a generic C++ optimization library.
     3  * This file is a part of LEMON, a generic C++ optimization library.
     4  *
     4  *
     5  * Copyright (C) 2003-2009
     5  * Copyright (C) 2003-2010
     6  * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     6  * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     7  * (Egervary Research Group on Combinatorial Optimization, EGRES).
     7  * (Egervary Research Group on Combinatorial Optimization, EGRES).
     8  *
     8  *
     9  * Permission to use, modify and distribute this software is granted
     9  * Permission to use, modify and distribute this software is granted
    10  * provided that this copyright notice appears in all copies. For
    10  * provided that this copyright notice appears in all copies. For
   419       : Parent(), _node_filter(0), _arc_filter(0) { }
   419       : Parent(), _node_filter(0), _arc_filter(0) { }
   420 
   420 
   421     void initialize(DGR& digraph, NF& node_filter, AF& arc_filter) {
   421     void initialize(DGR& digraph, NF& node_filter, AF& arc_filter) {
   422       Parent::initialize(digraph);
   422       Parent::initialize(digraph);
   423       _node_filter = &node_filter;
   423       _node_filter = &node_filter;
   424       _arc_filter = &arc_filter;      
   424       _arc_filter = &arc_filter;
   425     }
   425     }
   426 
   426 
   427   public:
   427   public:
   428 
   428 
   429     typedef typename Parent::Node Node;
   429     typedef typename Parent::Node Node;
   506     }
   506     }
   507 
   507 
   508   public:
   508   public:
   509 
   509 
   510     template <typename V>
   510     template <typename V>
   511     class NodeMap 
   511     class NodeMap
   512       : public SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>, 
   512       : public SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>,
   513 	      LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> {
   513               LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> {
   514       typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>,
   514       typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>,
   515 	LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> Parent;
   515         LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> Parent;
   516 
   516 
   517     public:
   517     public:
   518       typedef V Value;
   518       typedef V Value;
   519 
   519 
   520       NodeMap(const SubDigraphBase<DGR, NF, AF, ch>& adaptor)
   520       NodeMap(const SubDigraphBase<DGR, NF, AF, ch>& adaptor)
   533         return *this;
   533         return *this;
   534       }
   534       }
   535     };
   535     };
   536 
   536 
   537     template <typename V>
   537     template <typename V>
   538     class ArcMap 
   538     class ArcMap
   539       : public SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>,
   539       : public SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>,
   540 	      LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> {
   540               LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> {
   541       typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>,
   541       typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>,
   542         LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> Parent;
   542         LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> Parent;
   543 
   543 
   544     public:
   544     public:
   545       typedef V Value;
   545       typedef V Value;
   580       : Parent(), _node_filter(0), _arc_filter(0) { }
   580       : Parent(), _node_filter(0), _arc_filter(0) { }
   581 
   581 
   582     void initialize(DGR& digraph, NF& node_filter, AF& arc_filter) {
   582     void initialize(DGR& digraph, NF& node_filter, AF& arc_filter) {
   583       Parent::initialize(digraph);
   583       Parent::initialize(digraph);
   584       _node_filter = &node_filter;
   584       _node_filter = &node_filter;
   585       _arc_filter = &arc_filter;      
   585       _arc_filter = &arc_filter;
   586     }
   586     }
   587 
   587 
   588   public:
   588   public:
   589 
   589 
   590     typedef typename Parent::Node Node;
   590     typedef typename Parent::Node Node;
   649       }
   649       }
   650       return arc;
   650       return arc;
   651     }
   651     }
   652 
   652 
   653     template <typename V>
   653     template <typename V>
   654     class NodeMap 
   654     class NodeMap
   655       : public SubMapExtender<SubDigraphBase<DGR, NF, AF, false>,
   655       : public SubMapExtender<SubDigraphBase<DGR, NF, AF, false>,
   656           LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> {
   656           LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> {
   657       typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, false>, 
   657       typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, false>,
   658         LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> Parent;
   658         LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> Parent;
   659 
   659 
   660     public:
   660     public:
   661       typedef V Value;
   661       typedef V Value;
   662 
   662 
   676         return *this;
   676         return *this;
   677       }
   677       }
   678     };
   678     };
   679 
   679 
   680     template <typename V>
   680     template <typename V>
   681     class ArcMap 
   681     class ArcMap
   682       : public SubMapExtender<SubDigraphBase<DGR, NF, AF, false>,
   682       : public SubMapExtender<SubDigraphBase<DGR, NF, AF, false>,
   683           LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> {
   683           LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> {
   684       typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, false>,
   684       typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, false>,
   685         LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> Parent;
   685         LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> Parent;
   686 
   686 
  1019       }
  1019       }
  1020       return edge;
  1020       return edge;
  1021     }
  1021     }
  1022 
  1022 
  1023     template <typename V>
  1023     template <typename V>
  1024     class NodeMap 
  1024     class NodeMap
  1025       : public SubMapExtender<SubGraphBase<GR, NF, EF, ch>,
  1025       : public SubMapExtender<SubGraphBase<GR, NF, EF, ch>,
  1026           LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> {
  1026           LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> {
  1027       typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 
  1027       typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>,
  1028         LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> Parent;
  1028         LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> Parent;
  1029 
  1029 
  1030     public:
  1030     public:
  1031       typedef V Value;
  1031       typedef V Value;
  1032 
  1032 
  1046         return *this;
  1046         return *this;
  1047       }
  1047       }
  1048     };
  1048     };
  1049 
  1049 
  1050     template <typename V>
  1050     template <typename V>
  1051     class ArcMap 
  1051     class ArcMap
  1052       : public SubMapExtender<SubGraphBase<GR, NF, EF, ch>,
  1052       : public SubMapExtender<SubGraphBase<GR, NF, EF, ch>,
  1053           LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> {
  1053           LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> {
  1054       typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 
  1054       typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>,
  1055         LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> Parent;
  1055         LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> Parent;
  1056 
  1056 
  1057     public:
  1057     public:
  1058       typedef V Value;
  1058       typedef V Value;
  1059 
  1059 
  1073         return *this;
  1073         return *this;
  1074       }
  1074       }
  1075     };
  1075     };
  1076 
  1076 
  1077     template <typename V>
  1077     template <typename V>
  1078     class EdgeMap 
  1078     class EdgeMap
  1079       : public SubMapExtender<SubGraphBase<GR, NF, EF, ch>,
  1079       : public SubMapExtender<SubGraphBase<GR, NF, EF, ch>,
  1080         LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> {
  1080         LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> {
  1081       typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 
  1081       typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>,
  1082         LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> Parent;
  1082         LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> Parent;
  1083 
  1083 
  1084     public:
  1084     public:
  1085       typedef V Value;
  1085       typedef V Value;
  1086 
  1086 
  1115 
  1115 
  1116     typedef SubGraphBase Adaptor;
  1116     typedef SubGraphBase Adaptor;
  1117   protected:
  1117   protected:
  1118     NF* _node_filter;
  1118     NF* _node_filter;
  1119     EF* _edge_filter;
  1119     EF* _edge_filter;
  1120     SubGraphBase() 
  1120     SubGraphBase()
  1121 	  : Parent(), _node_filter(0), _edge_filter(0) { }
  1121           : Parent(), _node_filter(0), _edge_filter(0) { }
  1122 
  1122 
  1123     void initialize(GR& graph, NF& node_filter, EF& edge_filter) {
  1123     void initialize(GR& graph, NF& node_filter, EF& edge_filter) {
  1124       Parent::initialize(graph);
  1124       Parent::initialize(graph);
  1125       _node_filter = &node_filter;
  1125       _node_filter = &node_filter;
  1126       _edge_filter = &edge_filter;
  1126       _edge_filter = &edge_filter;
  1217       }
  1217       }
  1218       return edge;
  1218       return edge;
  1219     }
  1219     }
  1220 
  1220 
  1221     template <typename V>
  1221     template <typename V>
  1222     class NodeMap 
  1222     class NodeMap
  1223       : public SubMapExtender<SubGraphBase<GR, NF, EF, false>,
  1223       : public SubMapExtender<SubGraphBase<GR, NF, EF, false>,
  1224           LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> {
  1224           LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> {
  1225       typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>, 
  1225       typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>,
  1226         LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> Parent;
  1226         LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> Parent;
  1227 
  1227 
  1228     public:
  1228     public:
  1229       typedef V Value;
  1229       typedef V Value;
  1230 
  1230 
  1244         return *this;
  1244         return *this;
  1245       }
  1245       }
  1246     };
  1246     };
  1247 
  1247 
  1248     template <typename V>
  1248     template <typename V>
  1249     class ArcMap 
  1249     class ArcMap
  1250       : public SubMapExtender<SubGraphBase<GR, NF, EF, false>,
  1250       : public SubMapExtender<SubGraphBase<GR, NF, EF, false>,
  1251           LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> {
  1251           LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> {
  1252       typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>, 
  1252       typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>,
  1253         LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> Parent;
  1253         LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> Parent;
  1254 
  1254 
  1255     public:
  1255     public:
  1256       typedef V Value;
  1256       typedef V Value;
  1257 
  1257 
  1271         return *this;
  1271         return *this;
  1272       }
  1272       }
  1273     };
  1273     };
  1274 
  1274 
  1275     template <typename V>
  1275     template <typename V>
  1276     class EdgeMap 
  1276     class EdgeMap
  1277       : public SubMapExtender<SubGraphBase<GR, NF, EF, false>,
  1277       : public SubMapExtender<SubGraphBase<GR, NF, EF, false>,
  1278         LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> {
  1278         LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> {
  1279       typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>, 
  1279       typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>,
  1280 	LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> Parent;
  1280         LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> Parent;
  1281 
  1281 
  1282     public:
  1282     public:
  1283       typedef V Value;
  1283       typedef V Value;
  1284 
  1284 
  1285       EdgeMap(const SubGraphBase<GR, NF, EF, false>& adaptor)
  1285       EdgeMap(const SubGraphBase<GR, NF, EF, false>& adaptor)
  1502     public DigraphAdaptorExtender<
  1502     public DigraphAdaptorExtender<
  1503       SubDigraphBase<GR, NF, ConstMap<typename GR::Arc, Const<bool, true> >,
  1503       SubDigraphBase<GR, NF, ConstMap<typename GR::Arc, Const<bool, true> >,
  1504                      true> > {
  1504                      true> > {
  1505 #endif
  1505 #endif
  1506     typedef DigraphAdaptorExtender<
  1506     typedef DigraphAdaptorExtender<
  1507       SubDigraphBase<GR, NF, ConstMap<typename GR::Arc, Const<bool, true> >, 
  1507       SubDigraphBase<GR, NF, ConstMap<typename GR::Arc, Const<bool, true> >,
  1508                      true> > Parent;
  1508                      true> > Parent;
  1509 
  1509 
  1510   public:
  1510   public:
  1511 
  1511 
  1512     typedef GR Digraph;
  1512     typedef GR Digraph;
  1523 
  1523 
  1524     /// \brief Constructor
  1524     /// \brief Constructor
  1525     ///
  1525     ///
  1526     /// Creates a subgraph for the given digraph or graph with the
  1526     /// Creates a subgraph for the given digraph or graph with the
  1527     /// given node filter map.
  1527     /// given node filter map.
  1528     FilterNodes(GR& graph, NF& node_filter) 
  1528     FilterNodes(GR& graph, NF& node_filter)
  1529       : Parent(), const_true_map()
  1529       : Parent(), const_true_map()
  1530     {
  1530     {
  1531       Parent::initialize(graph, node_filter, const_true_map);
  1531       Parent::initialize(graph, node_filter, const_true_map);
  1532     }
  1532     }
  1533 
  1533 
  1561 
  1561 
  1562   template<typename GR, typename NF>
  1562   template<typename GR, typename NF>
  1563   class FilterNodes<GR, NF,
  1563   class FilterNodes<GR, NF,
  1564                     typename enable_if<UndirectedTagIndicator<GR> >::type> :
  1564                     typename enable_if<UndirectedTagIndicator<GR> >::type> :
  1565     public GraphAdaptorExtender<
  1565     public GraphAdaptorExtender<
  1566       SubGraphBase<GR, NF, ConstMap<typename GR::Edge, Const<bool, true> >, 
  1566       SubGraphBase<GR, NF, ConstMap<typename GR::Edge, Const<bool, true> >,
  1567                    true> > {
  1567                    true> > {
  1568 
  1568 
  1569     typedef GraphAdaptorExtender<
  1569     typedef GraphAdaptorExtender<
  1570       SubGraphBase<GR, NF, ConstMap<typename GR::Edge, Const<bool, true> >, 
  1570       SubGraphBase<GR, NF, ConstMap<typename GR::Edge, Const<bool, true> >,
  1571                    true> > Parent;
  1571                    true> > Parent;
  1572 
  1572 
  1573   public:
  1573   public:
  1574 
  1574 
  1575     typedef GR Graph;
  1575     typedef GR Graph;
  1651     public DigraphAdaptorExtender<
  1651     public DigraphAdaptorExtender<
  1652       SubDigraphBase<DGR, ConstMap<typename DGR::Node, Const<bool, true> >,
  1652       SubDigraphBase<DGR, ConstMap<typename DGR::Node, Const<bool, true> >,
  1653                      AF, false> > {
  1653                      AF, false> > {
  1654 #endif
  1654 #endif
  1655     typedef DigraphAdaptorExtender<
  1655     typedef DigraphAdaptorExtender<
  1656       SubDigraphBase<DGR, ConstMap<typename DGR::Node, Const<bool, true> >, 
  1656       SubDigraphBase<DGR, ConstMap<typename DGR::Node, Const<bool, true> >,
  1657                      AF, false> > Parent;
  1657                      AF, false> > Parent;
  1658 
  1658 
  1659   public:
  1659   public:
  1660 
  1660 
  1661     /// The type of the adapted digraph.
  1661     /// The type of the adapted digraph.
  1759 #else
  1759 #else
  1760   template<typename GR,
  1760   template<typename GR,
  1761            typename EF = typename GR::template EdgeMap<bool> >
  1761            typename EF = typename GR::template EdgeMap<bool> >
  1762   class FilterEdges :
  1762   class FilterEdges :
  1763     public GraphAdaptorExtender<
  1763     public GraphAdaptorExtender<
  1764       SubGraphBase<GR, ConstMap<typename GR::Node, Const<bool, true> >, 
  1764       SubGraphBase<GR, ConstMap<typename GR::Node, Const<bool, true> >,
  1765                    EF, false> > {
  1765                    EF, false> > {
  1766 #endif
  1766 #endif
  1767     typedef GraphAdaptorExtender<
  1767     typedef GraphAdaptorExtender<
  1768       SubGraphBase<GR, ConstMap<typename GR::Node, Const<bool, true > >, 
  1768       SubGraphBase<GR, ConstMap<typename GR::Node, Const<bool, true > >,
  1769                    EF, false> > Parent;
  1769                    EF, false> > Parent;
  1770 
  1770 
  1771   public:
  1771   public:
  1772 
  1772 
  1773     /// The type of the adapted graph.
  1773     /// The type of the adapted graph.
  1788 
  1788 
  1789     /// \brief Constructor
  1789     /// \brief Constructor
  1790     ///
  1790     ///
  1791     /// Creates a subgraph for the given graph with the given edge
  1791     /// Creates a subgraph for the given graph with the given edge
  1792     /// filter map.
  1792     /// filter map.
  1793     FilterEdges(GR& graph, EF& edge_filter) 
  1793     FilterEdges(GR& graph, EF& edge_filter)
  1794       : Parent(), const_true_map() {
  1794       : Parent(), const_true_map() {
  1795       Parent::initialize(graph, const_true_map, edge_filter);
  1795       Parent::initialize(graph, const_true_map, edge_filter);
  1796     }
  1796     }
  1797 
  1797 
  1798     /// \brief Sets the status of the given edge
  1798     /// \brief Sets the status of the given edge
  1856       friend class UndirectorBase;
  1856       friend class UndirectorBase;
  1857     protected:
  1857     protected:
  1858       Edge _edge;
  1858       Edge _edge;
  1859       bool _forward;
  1859       bool _forward;
  1860 
  1860 
  1861       Arc(const Edge& edge, bool forward) 
  1861       Arc(const Edge& edge, bool forward)
  1862         : _edge(edge), _forward(forward) {}
  1862         : _edge(edge), _forward(forward) {}
  1863 
  1863 
  1864     public:
  1864     public:
  1865       Arc() {}
  1865       Arc() {}
  1866 
  1866 
  2096 
  2096 
  2097       ArcMapBase(const UndirectorBase<DGR>& adaptor) :
  2097       ArcMapBase(const UndirectorBase<DGR>& adaptor) :
  2098         _forward(*adaptor._digraph), _backward(*adaptor._digraph) {}
  2098         _forward(*adaptor._digraph), _backward(*adaptor._digraph) {}
  2099 
  2099 
  2100       ArcMapBase(const UndirectorBase<DGR>& adaptor, const V& value)
  2100       ArcMapBase(const UndirectorBase<DGR>& adaptor, const V& value)
  2101         : _forward(*adaptor._digraph, value), 
  2101         : _forward(*adaptor._digraph, value),
  2102           _backward(*adaptor._digraph, value) {}
  2102           _backward(*adaptor._digraph, value) {}
  2103 
  2103 
  2104       void set(const Arc& a, const V& value) {
  2104       void set(const Arc& a, const V& value) {
  2105         if (direction(a)) {
  2105         if (direction(a)) {
  2106           _forward.set(a, value);
  2106           _forward.set(a, value);
  2214     typedef typename ItemSetTraits<DGR, Node>::ItemNotifier NodeNotifier;
  2214     typedef typename ItemSetTraits<DGR, Node>::ItemNotifier NodeNotifier;
  2215     NodeNotifier& notifier(Node) const { return _digraph->notifier(Node()); }
  2215     NodeNotifier& notifier(Node) const { return _digraph->notifier(Node()); }
  2216 
  2216 
  2217     typedef typename ItemSetTraits<DGR, Edge>::ItemNotifier EdgeNotifier;
  2217     typedef typename ItemSetTraits<DGR, Edge>::ItemNotifier EdgeNotifier;
  2218     EdgeNotifier& notifier(Edge) const { return _digraph->notifier(Edge()); }
  2218     EdgeNotifier& notifier(Edge) const { return _digraph->notifier(Edge()); }
  2219     
  2219 
  2220     typedef EdgeNotifier ArcNotifier;
  2220     typedef EdgeNotifier ArcNotifier;
  2221     ArcNotifier& notifier(Arc) const { return _digraph->notifier(Edge()); }
  2221     ArcNotifier& notifier(Arc) const { return _digraph->notifier(Edge()); }
  2222 
  2222 
  2223   protected:
  2223   protected:
  2224 
  2224 
  2726 #else
  2726 #else
  2727   template<typename DGR,
  2727   template<typename DGR,
  2728            typename CM = typename DGR::template ArcMap<int>,
  2728            typename CM = typename DGR::template ArcMap<int>,
  2729            typename FM = CM,
  2729            typename FM = CM,
  2730            typename TL = Tolerance<typename CM::Value> >
  2730            typename TL = Tolerance<typename CM::Value> >
  2731   class ResidualDigraph 
  2731   class ResidualDigraph
  2732     : public SubDigraph<
  2732     : public SubDigraph<
  2733         Undirector<const DGR>,
  2733         Undirector<const DGR>,
  2734         ConstMap<typename DGR::Node, Const<bool, true> >,
  2734         ConstMap<typename DGR::Node, Const<bool, true> >,
  2735         typename Undirector<const DGR>::template CombinedArcMap<
  2735         typename Undirector<const DGR>::template CombinedArcMap<
  2736           _adaptor_bits::ResForwardFilter<const DGR, CM, FM, TL>,
  2736           _adaptor_bits::ResForwardFilter<const DGR, CM, FM, TL>,
  2783     ///
  2783     ///
  2784     /// Constructor of the residual digraph adaptor. The parameters are the
  2784     /// Constructor of the residual digraph adaptor. The parameters are the
  2785     /// digraph, the capacity map, the flow map, and a tolerance object.
  2785     /// digraph, the capacity map, the flow map, and a tolerance object.
  2786     ResidualDigraph(const DGR& digraph, const CM& capacity,
  2786     ResidualDigraph(const DGR& digraph, const CM& capacity,
  2787                     FM& flow, const TL& tolerance = Tolerance())
  2787                     FM& flow, const TL& tolerance = Tolerance())
  2788       : Parent(), _capacity(&capacity), _flow(&flow), 
  2788       : Parent(), _capacity(&capacity), _flow(&flow),
  2789         _graph(digraph), _node_filter(),
  2789         _graph(digraph), _node_filter(),
  2790         _forward_filter(capacity, flow, tolerance),
  2790         _forward_filter(capacity, flow, tolerance),
  2791         _backward_filter(capacity, flow, tolerance),
  2791         _backward_filter(capacity, flow, tolerance),
  2792         _arc_filter(_forward_filter, _backward_filter)
  2792         _arc_filter(_forward_filter, _backward_filter)
  2793     {
  2793     {
  2865       typedef Arc Key;
  2865       typedef Arc Key;
  2866       /// The value type of the map
  2866       /// The value type of the map
  2867       typedef typename CapacityMap::Value Value;
  2867       typedef typename CapacityMap::Value Value;
  2868 
  2868 
  2869       /// Constructor
  2869       /// Constructor
  2870       ResidualCapacity(const ResidualDigraph<DGR, CM, FM, TL>& adaptor) 
  2870       ResidualCapacity(const ResidualDigraph<DGR, CM, FM, TL>& adaptor)
  2871         : _adaptor(&adaptor) {}
  2871         : _adaptor(&adaptor) {}
  2872 
  2872 
  2873       /// Returns the value associated with the given residual arc
  2873       /// Returns the value associated with the given residual arc
  2874       Value operator[](const Arc& a) const {
  2874       Value operator[](const Arc& a) const {
  2875         return _adaptor->residualCapacity(a);
  2875         return _adaptor->residualCapacity(a);
  3445     /// \brief Node map combined from two original node maps
  3445     /// \brief Node map combined from two original node maps
  3446     ///
  3446     ///
  3447     /// This map adaptor class adapts two node maps of the original digraph
  3447     /// This map adaptor class adapts two node maps of the original digraph
  3448     /// to get a node map of the split digraph.
  3448     /// to get a node map of the split digraph.
  3449     /// Its value type is inherited from the first node map type (\c IN).
  3449     /// Its value type is inherited from the first node map type (\c IN).
  3450     /// \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.
  3451     /// \tparam OUT The type of the node map for the out-nodes.
  3451     /// \tparam OUT The type of the node map for the out-nodes.
  3452     template <typename IN, typename OUT>
  3452     template <typename IN, typename OUT>
  3453     class CombinedNodeMap {
  3453     class CombinedNodeMap {
  3454     public:
  3454     public:
  3455 
  3455