diff -r 70b199792735 -r ad40f7d32846 lemon/adaptors.h --- a/lemon/adaptors.h Fri Aug 09 11:07:27 2013 +0200 +++ b/lemon/adaptors.h Sun Aug 11 15:28:12 2013 +0200 @@ -2,7 +2,7 @@ * * This file is a part of LEMON, a generic C++ optimization library. * - * Copyright (C) 2003-2009 + * Copyright (C) 2003-2010 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport * (Egervary Research Group on Combinatorial Optimization, EGRES). * @@ -360,6 +360,9 @@ /// by adding or removing nodes or arcs, unless the \c GR template /// parameter is set to be \c const. /// + /// This class provides item counting in the same time as the adapted + /// digraph structure. + /// /// \tparam DGR The type of the adapted digraph. /// It must conform to the \ref concepts::Digraph "Digraph" concept. /// It can also be specified to be \c const. @@ -418,7 +421,7 @@ void initialize(DGR& digraph, NF& node_filter, AF& arc_filter) { Parent::initialize(digraph); _node_filter = &node_filter; - _arc_filter = &arc_filter; + _arc_filter = &arc_filter; } public: @@ -505,11 +508,11 @@ public: template - class NodeMap - : public SubMapExtender, - LEMON_SCOPE_FIX(DigraphAdaptorBase, NodeMap)> { + class NodeMap + : public SubMapExtender, + LEMON_SCOPE_FIX(DigraphAdaptorBase, NodeMap)> { typedef SubMapExtender, - LEMON_SCOPE_FIX(DigraphAdaptorBase, NodeMap)> Parent; + LEMON_SCOPE_FIX(DigraphAdaptorBase, NodeMap)> Parent; public: typedef V Value; @@ -532,9 +535,9 @@ }; template - class ArcMap + class ArcMap : public SubMapExtender, - LEMON_SCOPE_FIX(DigraphAdaptorBase, ArcMap)> { + LEMON_SCOPE_FIX(DigraphAdaptorBase, ArcMap)> { typedef SubMapExtender, LEMON_SCOPE_FIX(DigraphAdaptorBase, ArcMap)> Parent; @@ -579,7 +582,7 @@ void initialize(DGR& digraph, NF& node_filter, AF& arc_filter) { Parent::initialize(digraph); _node_filter = &node_filter; - _arc_filter = &arc_filter; + _arc_filter = &arc_filter; } public: @@ -648,10 +651,10 @@ } template - class NodeMap + class NodeMap : public SubMapExtender, LEMON_SCOPE_FIX(DigraphAdaptorBase, NodeMap)> { - typedef SubMapExtender, + typedef SubMapExtender, LEMON_SCOPE_FIX(DigraphAdaptorBase, NodeMap)> Parent; public: @@ -675,7 +678,7 @@ }; template - class ArcMap + class ArcMap : public SubMapExtender, LEMON_SCOPE_FIX(DigraphAdaptorBase, ArcMap)> { typedef SubMapExtender, @@ -719,6 +722,8 @@ /// by adding or removing nodes or arcs, unless the \c GR template /// parameter is set to be \c const. /// + /// This class provides only linear time counting for nodes and arcs. + /// /// \tparam DGR The type of the adapted digraph. /// It must conform to the \ref concepts::Digraph "Digraph" concept. /// It can also be specified to be \c const. @@ -1016,10 +1021,10 @@ } template - class NodeMap + class NodeMap : public SubMapExtender, LEMON_SCOPE_FIX(GraphAdaptorBase, NodeMap)> { - typedef SubMapExtender, + typedef SubMapExtender, LEMON_SCOPE_FIX(GraphAdaptorBase, NodeMap)> Parent; public: @@ -1043,10 +1048,10 @@ }; template - class ArcMap + class ArcMap : public SubMapExtender, LEMON_SCOPE_FIX(GraphAdaptorBase, ArcMap)> { - typedef SubMapExtender, + typedef SubMapExtender, LEMON_SCOPE_FIX(GraphAdaptorBase, ArcMap)> Parent; public: @@ -1070,10 +1075,10 @@ }; template - class EdgeMap + class EdgeMap : public SubMapExtender, LEMON_SCOPE_FIX(GraphAdaptorBase, EdgeMap)> { - typedef SubMapExtender, + typedef SubMapExtender, LEMON_SCOPE_FIX(GraphAdaptorBase, EdgeMap)> Parent; public: @@ -1112,8 +1117,8 @@ protected: NF* _node_filter; EF* _edge_filter; - SubGraphBase() - : Parent(), _node_filter(0), _edge_filter(0) { } + SubGraphBase() + : Parent(), _node_filter(0), _edge_filter(0) { } void initialize(GR& graph, NF& node_filter, EF& edge_filter) { Parent::initialize(graph); @@ -1214,10 +1219,10 @@ } template - class NodeMap + class NodeMap : public SubMapExtender, LEMON_SCOPE_FIX(GraphAdaptorBase, NodeMap)> { - typedef SubMapExtender, + typedef SubMapExtender, LEMON_SCOPE_FIX(GraphAdaptorBase, NodeMap)> Parent; public: @@ -1241,10 +1246,10 @@ }; template - class ArcMap + class ArcMap : public SubMapExtender, LEMON_SCOPE_FIX(GraphAdaptorBase, ArcMap)> { - typedef SubMapExtender, + typedef SubMapExtender, LEMON_SCOPE_FIX(GraphAdaptorBase, ArcMap)> Parent; public: @@ -1268,11 +1273,11 @@ }; template - class EdgeMap + class EdgeMap : public SubMapExtender, LEMON_SCOPE_FIX(GraphAdaptorBase, EdgeMap)> { - typedef SubMapExtender, - LEMON_SCOPE_FIX(GraphAdaptorBase, EdgeMap)> Parent; + typedef SubMapExtender, + LEMON_SCOPE_FIX(GraphAdaptorBase, EdgeMap)> Parent; public: typedef V Value; @@ -1314,6 +1319,8 @@ /// by adding or removing nodes or edges, unless the \c GR template /// parameter is set to be \c const. /// + /// This class provides only linear time counting for nodes, edges and arcs. + /// /// \tparam GR The type of the adapted graph. /// It must conform to the \ref concepts::Graph "Graph" concept. /// It can also be specified to be \c const. @@ -1471,6 +1478,8 @@ /// by adding or removing nodes or arcs/edges, unless the \c GR template /// parameter is set to be \c const. /// + /// This class provides only linear time item counting. + /// /// \tparam GR The type of the adapted digraph or graph. /// It must conform to the \ref concepts::Digraph "Digraph" concept /// or the \ref concepts::Graph "Graph" concept. @@ -1495,7 +1504,7 @@ true> > { #endif typedef DigraphAdaptorExtender< - SubDigraphBase >, + SubDigraphBase >, true> > Parent; public: @@ -1516,7 +1525,7 @@ /// /// Creates a subgraph for the given digraph or graph with the /// given node filter map. - FilterNodes(GR& graph, NF& node_filter) + FilterNodes(GR& graph, NF& node_filter) : Parent(), const_true_map() { Parent::initialize(graph, node_filter, const_true_map); @@ -1554,11 +1563,11 @@ class FilterNodes >::type> : public GraphAdaptorExtender< - SubGraphBase >, + SubGraphBase >, true> > { typedef GraphAdaptorExtender< - SubGraphBase >, + SubGraphBase >, true> > Parent; public: @@ -1619,6 +1628,8 @@ /// by adding or removing nodes or arcs, unless the \c GR template /// parameter is set to be \c const. /// + /// This class provides only linear time counting for nodes and arcs. + /// /// \tparam DGR The type of the adapted digraph. /// It must conform to the \ref concepts::Digraph "Digraph" concept. /// It can also be specified to be \c const. @@ -1642,7 +1653,7 @@ AF, false> > { #endif typedef DigraphAdaptorExtender< - SubDigraphBase >, + SubDigraphBase >, AF, false> > Parent; public: @@ -1729,6 +1740,8 @@ /// by adding or removing nodes or edges, unless the \c GR template /// parameter is set to be \c const. /// + /// This class provides only linear time counting for nodes, edges and arcs. + /// /// \tparam GR The type of the adapted graph. /// It must conform to the \ref concepts::Graph "Graph" concept. /// It can also be specified to be \c const. @@ -1748,11 +1761,11 @@ typename EF = typename GR::template EdgeMap > class FilterEdges : public GraphAdaptorExtender< - SubGraphBase >, + SubGraphBase >, EF, false> > { #endif typedef GraphAdaptorExtender< - SubGraphBase >, + SubGraphBase >, EF, false> > Parent; public: @@ -1777,7 +1790,7 @@ /// /// Creates a subgraph for the given graph with the given edge /// filter map. - FilterEdges(GR& graph, EF& edge_filter) + FilterEdges(GR& graph, EF& edge_filter) : Parent(), const_true_map() { Parent::initialize(graph, const_true_map, edge_filter); } @@ -1845,7 +1858,7 @@ Edge _edge; bool _forward; - Arc(const Edge& edge, bool forward) + Arc(const Edge& edge, bool forward) : _edge(edge), _forward(forward) {} public: @@ -2085,7 +2098,7 @@ _forward(*adaptor._digraph), _backward(*adaptor._digraph) {} ArcMapBase(const UndirectorBase& adaptor, const V& value) - : _forward(*adaptor._digraph, value), + : _forward(*adaptor._digraph, value), _backward(*adaptor._digraph, value) {} void set(const Arc& a, const V& value) { @@ -2203,7 +2216,7 @@ typedef typename ItemSetTraits::ItemNotifier EdgeNotifier; EdgeNotifier& notifier(Edge) const { return _digraph->notifier(Edge()); } - + typedef EdgeNotifier ArcNotifier; ArcNotifier& notifier(Arc) const { return _digraph->notifier(Edge()); } @@ -2232,6 +2245,9 @@ /// by adding or removing nodes or edges, unless the \c GR template /// parameter is set to be \c const. /// + /// This class provides item counting in the same time as the adapted + /// digraph structure. + /// /// \tparam DGR The type of the adapted digraph. /// It must conform to the \ref concepts::Digraph "Digraph" concept. /// It can also be specified to be \c const. @@ -2535,6 +2551,9 @@ /// by adding or removing nodes or arcs, unless the \c GR template /// parameter is set to be \c const. /// + /// This class provides item counting in the same time as the adapted + /// graph structure. + /// /// \tparam GR The type of the adapted graph. /// It must conform to the \ref concepts::Graph "Graph" concept. /// It can also be specified to be \c const. @@ -2678,6 +2697,8 @@ /// arcs). /// This class conforms to the \ref concepts::Digraph "Digraph" concept. /// + /// This class provides only linear time counting for nodes and arcs. + /// /// \tparam DGR The type of the adapted digraph. /// It must conform to the \ref concepts::Digraph "Digraph" concept. /// It is implicitly \c const. @@ -2707,7 +2728,7 @@ typename CM = typename DGR::template ArcMap, typename FM = CM, typename TL = Tolerance > - class ResidualDigraph + class ResidualDigraph : public SubDigraph< Undirector, ConstMap >, @@ -2764,7 +2785,7 @@ /// digraph, the capacity map, the flow map, and a tolerance object. ResidualDigraph(const DGR& digraph, const CM& capacity, FM& flow, const TL& tolerance = Tolerance()) - : Parent(), _capacity(&capacity), _flow(&flow), + : Parent(), _capacity(&capacity), _flow(&flow), _graph(digraph), _node_filter(), _forward_filter(capacity, flow, tolerance), _backward_filter(capacity, flow, tolerance), @@ -2846,7 +2867,7 @@ typedef typename CapacityMap::Value Value; /// Constructor - ResidualCapacity(const ResidualDigraph& adaptor) + ResidualCapacity(const ResidualDigraph& adaptor) : _adaptor(&adaptor) {} /// Returns the value associated with the given residual arc @@ -3325,6 +3346,9 @@ /// costs/capacities of the original digraph to the \e bind \e arcs /// in the adaptor. /// + /// This class provides item counting in the same time as the adapted + /// digraph structure. + /// /// \tparam DGR The type of the adapted digraph. /// It must conform to the \ref concepts::Digraph "Digraph" concept. /// It is implicitly \c const. @@ -3423,7 +3447,7 @@ /// This map adaptor class adapts two node maps of the original digraph /// to get a node map of the split digraph. /// Its value type is inherited from the first node map type (\c IN). - /// \tparam IN The type of the node map for the in-nodes. + /// \tparam IN The type of the node map for the in-nodes. /// \tparam OUT The type of the node map for the out-nodes. template class CombinedNodeMap {