# HG changeset patch # User Peter Kovacs # Date 1231683860 -3600 # Node ID c246659c8b19c19ba6fcc7688af5a2a83bfc8110 # Parent aea2dc0518cefa8e0816ff95f46ec10d9eb87253 Remove non-checked subgraph adaptors + rename parameters (#67) diff -r aea2dc0518ce -r c246659c8b19 lemon/adaptors.h --- a/lemon/adaptors.h Fri Jan 09 14:03:25 2009 +0100 +++ b/lemon/adaptors.h Sun Jan 11 15:24:20 2009 +0100 @@ -353,22 +353,26 @@ /// It conforms to the \ref concepts::Digraph "Digraph" concept. /// /// The adapted digraph can also be modified through this adaptor - /// by adding or removing nodes or arcs, unless the \c _Digraph template + /// by adding or removing nodes or arcs, unless the \c GR template /// parameter is set to be \c const. /// - /// \tparam _Digraph The type of the adapted digraph. + /// \tparam GR 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. /// /// \note The \c Node and \c Arc types of this adaptor and the adapted /// digraph are convertible to each other. - template + template +#ifdef DOXYGEN + class ReverseDigraph { +#else class ReverseDigraph : - public DigraphAdaptorExtender > { + public DigraphAdaptorExtender > { +#endif public: - typedef _Digraph Digraph; - typedef DigraphAdaptorExtender< - ReverseDigraphBase<_Digraph> > Parent; + /// The type of the adapted digraph. + typedef GR Digraph; + typedef DigraphAdaptorExtender > Parent; protected: ReverseDigraph() { } public: @@ -386,9 +390,9 @@ /// This function just returns a read-only \ref ReverseDigraph adaptor. /// \ingroup graph_adaptors /// \relates ReverseDigraph - template - ReverseDigraph reverseDigraph(const Digraph& digraph) { - return ReverseDigraph(digraph); + template + ReverseDigraph reverseDigraph(const GR& digraph) { + return ReverseDigraph(digraph); } @@ -696,28 +700,25 @@ /// A \c bool node map and a \c bool arc map must be specified, which /// define the filters for nodes and arcs. /// Only the nodes and arcs with \c true filter value are - /// shown in the subdigraph. This adaptor conforms to the \ref - /// concepts::Digraph "Digraph" concept. If the \c _checked parameter - /// is \c true, then the arcs incident to hidden nodes are also - /// filtered out. + /// shown in the subdigraph. The arcs that are incident to hidden + /// nodes are also filtered out. + /// This adaptor conforms to the \ref concepts::Digraph "Digraph" concept. /// /// The adapted digraph can also be modified through this adaptor - /// by adding or removing nodes or arcs, unless the \c _Digraph template + /// by adding or removing nodes or arcs, unless the \c GR template /// parameter is set to be \c const. /// - /// \tparam _Digraph The type of the adapted digraph. + /// \tparam GR 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. - /// \tparam _NodeFilterMap A \c bool (or convertible) node map of the - /// adapted digraph. The default map type is - /// \ref concepts::Digraph::NodeMap "_Digraph::NodeMap". - /// \tparam _ArcFilterMap A \c bool (or convertible) arc map of the - /// adapted digraph. The default map type is - /// \ref concepts::Digraph::ArcMap "_Digraph::ArcMap". - /// \tparam _checked If this parameter is set to \c false, then the arc - /// filtering is not checked with respect to the node filter. - /// Otherwise, each arc that is incident to a hidden node is automatically - /// filtered out. This is the default option. + /// \tparam NF The type of the node filter map. + /// It must be a \c bool (or convertible) node map of the + /// adapted digraph. The default type is + /// \ref concepts::Digraph::NodeMap "GR::NodeMap". + /// \tparam AF The type of the arc filter map. + /// It must be \c bool (or convertible) arc map of the + /// adapted digraph. The default type is + /// \ref concepts::Digraph::ArcMap "GR::ArcMap". /// /// \note The \c Node and \c Arc types of this adaptor and the adapted /// digraph are convertible to each other. @@ -725,30 +726,25 @@ /// \see FilterNodes /// \see FilterArcs #ifdef DOXYGEN - template + template + class SubDigraph { #else - template, - typename _ArcFilterMap = typename _Digraph::template ArcMap, - bool _checked = true> + template, + typename AF = typename GR::template ArcMap > + class SubDigraph : + public DigraphAdaptorExtender > { #endif - class SubDigraph - : public DigraphAdaptorExtender< - SubDigraphBase<_Digraph, _NodeFilterMap, _ArcFilterMap, _checked> > { public: /// The type of the adapted digraph. - typedef _Digraph Digraph; + typedef GR Digraph; /// The type of the node filter map. - typedef _NodeFilterMap NodeFilterMap; + typedef NF NodeFilterMap; /// The type of the arc filter map. - typedef _ArcFilterMap ArcFilterMap; - - typedef DigraphAdaptorExtender< - SubDigraphBase<_Digraph, _NodeFilterMap, _ArcFilterMap, _checked> > - Parent; + typedef AF ArcFilterMap; + + typedef DigraphAdaptorExtender > + Parent; typedef typename Parent::Node Node; typedef typename Parent::Arc Arc; @@ -827,35 +823,36 @@ /// This function just returns a read-only \ref SubDigraph adaptor. /// \ingroup graph_adaptors /// \relates SubDigraph - template - SubDigraph - subDigraph(const Digraph& digraph, NodeFilterMap& nfm, ArcFilterMap& afm) { - return SubDigraph - (digraph, nfm, afm); + template + SubDigraph + subDigraph(const GR& digraph, + NF& node_filter_map, AF& arc_filter_map) { + return SubDigraph + (digraph, node_filter_map, arc_filter_map); } - template - SubDigraph - subDigraph(const Digraph& digraph, - const NodeFilterMap& nfm, ArcFilterMap& afm) { - return SubDigraph - (digraph, nfm, afm); + template + SubDigraph + subDigraph(const GR& digraph, + const NF& node_filter_map, AF& arc_filter_map) { + return SubDigraph + (digraph, node_filter_map, arc_filter_map); } - template - SubDigraph - subDigraph(const Digraph& digraph, - NodeFilterMap& nfm, const ArcFilterMap& afm) { - return SubDigraph - (digraph, nfm, afm); + template + SubDigraph + subDigraph(const GR& digraph, + NF& node_filter_map, const AF& arc_filter_map) { + return SubDigraph + (digraph, node_filter_map, arc_filter_map); } - template - SubDigraph - subDigraph(const Digraph& digraph, - const NodeFilterMap& nfm, const ArcFilterMap& afm) { - return SubDigraph(digraph, nfm, afm); + template + SubDigraph + subDigraph(const GR& digraph, + const NF& node_filter_map, const AF& arc_filter_map) { + return SubDigraph + (digraph, node_filter_map, arc_filter_map); } @@ -1292,28 +1289,25 @@ /// A \c bool node map and a \c bool edge map must be specified, which /// define the filters for nodes and edges. /// Only the nodes and edges with \c true filter value are - /// shown in the subgraph. This adaptor conforms to the \ref - /// concepts::Graph "Graph" concept. If the \c _checked parameter is - /// \c true, then the edges incident to hidden nodes are also - /// filtered out. + /// shown in the subgraph. The edges that are incident to hidden + /// nodes are also filtered out. + /// This adaptor conforms to the \ref concepts::Graph "Graph" concept. /// /// The adapted graph can also be modified through this adaptor - /// by adding or removing nodes or edges, unless the \c _Graph template + /// by adding or removing nodes or edges, unless the \c GR template /// parameter is set to be \c const. /// - /// \tparam _Graph The type of the adapted graph. + /// \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. - /// \tparam _NodeFilterMap A \c bool (or convertible) node map of the - /// adapted graph. The default map type is - /// \ref concepts::Graph::NodeMap "_Graph::NodeMap". - /// \tparam _EdgeFilterMap A \c bool (or convertible) edge map of the - /// adapted graph. The default map type is - /// \ref concepts::Graph::EdgeMap "_Graph::EdgeMap". - /// \tparam _checked If this parameter is set to \c false, then the edge - /// filtering is not checked with respect to the node filter. - /// Otherwise, each edge that is incident to a hidden node is automatically - /// filtered out. This is the default option. + /// \tparam NF The type of the node filter map. + /// It must be a \c bool (or convertible) node map of the + /// adapted graph. The default type is + /// \ref concepts::Graph::NodeMap "GR::NodeMap". + /// \tparam EF The type of the edge filter map. + /// It must be a \c bool (or convertible) edge map of the + /// adapted graph. The default type is + /// \ref concepts::Graph::EdgeMap "GR::EdgeMap". /// /// \note The \c Node, \c Edge and \c Arc types of this adaptor and the /// adapted graph are convertible to each other. @@ -1321,29 +1315,25 @@ /// \see FilterNodes /// \see FilterEdges #ifdef DOXYGEN - template + template + class SubGraph { #else - template, - typename _EdgeFilterMap = typename _Graph::template EdgeMap, - bool _checked = true> + template, + typename EF = typename GR::template EdgeMap > + class SubGraph : + public GraphAdaptorExtender > { #endif - class SubGraph - : public GraphAdaptorExtender< - SubGraphBase<_Graph, _NodeFilterMap, _EdgeFilterMap, _checked> > { public: /// The type of the adapted graph. - typedef _Graph Graph; + typedef GR Graph; /// The type of the node filter map. - typedef _NodeFilterMap NodeFilterMap; + typedef NF NodeFilterMap; /// The type of the edge filter map. - typedef _EdgeFilterMap EdgeFilterMap; - - typedef GraphAdaptorExtender< - SubGraphBase<_Graph, _NodeFilterMap, _EdgeFilterMap, _checked> > Parent; + typedef EF EdgeFilterMap; + + typedef GraphAdaptorExtender< SubGraphBase > + Parent; typedef typename Parent::Node Node; typedef typename Parent::Edge Edge; @@ -1422,34 +1412,36 @@ /// This function just returns a read-only \ref SubGraph adaptor. /// \ingroup graph_adaptors /// \relates SubGraph - template - SubGraph - subGraph(const Graph& graph, NodeFilterMap& nfm, ArcFilterMap& efm) { - return SubGraph(graph, nfm, efm); + template + SubGraph + subGraph(const GR& graph, + NF& node_filter_map, EF& edge_filter_map) { + return SubGraph + (graph, node_filter_map, edge_filter_map); } - template - SubGraph - subGraph(const Graph& graph, - const NodeFilterMap& nfm, ArcFilterMap& efm) { - return SubGraph - (graph, nfm, efm); + template + SubGraph + subGraph(const GR& graph, + const NF& node_filter_map, EF& edge_filter_map) { + return SubGraph + (graph, node_filter_map, edge_filter_map); } - template - SubGraph - subGraph(const Graph& graph, - NodeFilterMap& nfm, const ArcFilterMap& efm) { - return SubGraph - (graph, nfm, efm); + template + SubGraph + subGraph(const GR& graph, + NF& node_filter_map, const EF& edge_filter_map) { + return SubGraph + (graph, node_filter_map, edge_filter_map); } - template - SubGraph - subGraph(const Graph& graph, - const NodeFilterMap& nfm, const ArcFilterMap& efm) { - return SubGraph - (graph, nfm, efm); + template + SubGraph + subGraph(const GR& graph, + const NF& node_filter_map, const EF& edge_filter_map) { + return SubGraph + (graph, node_filter_map, edge_filter_map); } @@ -1463,48 +1455,42 @@ /// arcs/edges incident to nodes both with \c true filter value are shown /// in the subgraph. This adaptor conforms to the \ref concepts::Digraph /// "Digraph" concept or the \ref concepts::Graph "Graph" concept - /// depending on the \c _Graph template parameter. + /// depending on the \c GR template parameter. /// /// The adapted (di)graph can also be modified through this adaptor - /// by adding or removing nodes or arcs/edges, unless the \c _Graph template + /// by adding or removing nodes or arcs/edges, unless the \c GR template /// parameter is set to be \c const. /// - /// \tparam _Graph The type of the adapted digraph or graph. + /// \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. /// It can also be specified to be \c const. - /// \tparam _NodeFilterMap A \c bool (or convertible) node map of the - /// adapted (di)graph. The default map type is - /// \ref concepts::Graph::NodeMap "_Graph::NodeMap". - /// \tparam _checked If this parameter is set to \c false then the arc/edge - /// filtering is not checked with respect to the node filter. In this - /// case only isolated nodes can be filtered out from the graph. - /// Otherwise, each arc/edge that is incident to a hidden node is - /// automatically filtered out. This is the default option. + /// \tparam NF The type of the node filter map. + /// It must be a \c bool (or convertible) node map of the + /// adapted (di)graph. The default type is + /// \ref concepts::Graph::NodeMap "GR::NodeMap". /// /// \note The \c Node and Arc/Edge types of this adaptor and the /// adapted (di)graph are convertible to each other. #ifdef DOXYGEN - template + template + class FilterNodes { #else - template, - bool _checked = true, + template, typename Enable = void> + class FilterNodes : + public DigraphAdaptorExtender< + SubDigraphBase, true> > { #endif - class FilterNodes - : public SubDigraph<_Digraph, _NodeFilterMap, - ConstMap, _checked> { public: - typedef _Digraph Digraph; - typedef _NodeFilterMap NodeFilterMap; - - typedef SubDigraph, _checked> - Parent; + typedef GR Digraph; + typedef NF NodeFilterMap; + + typedef DigraphAdaptorExtender< + SubDigraphBase, true> > + Parent; typedef typename Parent::Node Node; @@ -1521,12 +1507,9 @@ /// /// Creates a subgraph for the given digraph or graph with the /// given node filter map. -#ifdef DOXYGEN - FilterNodes(_Graph& graph, _NodeFilterMap& node_filter) : -#else - FilterNodes(Digraph& graph, NodeFilterMap& node_filter) : -#endif - Parent(), const_true_map(true) { + FilterNodes(GR& graph, NodeFilterMap& node_filter) : + Parent(), const_true_map(true) + { Parent::setDigraph(graph); Parent::setNodeFilterMap(node_filter); Parent::setArcFilterMap(const_true_map); @@ -1560,16 +1543,18 @@ }; - template - class FilterNodes<_Graph, _NodeFilterMap, _checked, - typename enable_if >::type> - : public SubGraph<_Graph, _NodeFilterMap, - ConstMap, _checked> { + template + class FilterNodes >::type> : + public GraphAdaptorExtender< + SubGraphBase, true> > { + public: - typedef _Graph Graph; - typedef _NodeFilterMap NodeFilterMap; - typedef SubGraph > Parent; + typedef GR Graph; + typedef NF NodeFilterMap; + typedef GraphAdaptorExtender< + SubGraphBase, true> > + Parent; typedef typename Parent::Node Node; protected: @@ -1601,16 +1586,16 @@ /// This function just returns a read-only \ref FilterNodes adaptor. /// \ingroup graph_adaptors /// \relates FilterNodes - template - FilterNodes - filterNodes(const Digraph& digraph, NodeFilterMap& nfm) { - return FilterNodes(digraph, nfm); + template + FilterNodes + filterNodes(const GR& graph, NF& node_filter_map) { + return FilterNodes(graph, node_filter_map); } - template - FilterNodes - filterNodes(const Digraph& digraph, const NodeFilterMap& nfm) { - return FilterNodes(digraph, nfm); + template + FilterNodes + filterNodes(const GR& graph, const NF& node_filter_map) { + return FilterNodes(graph, node_filter_map); } /// \ingroup graph_adaptors @@ -1624,35 +1609,39 @@ /// "Digraph" concept. /// /// The adapted digraph can also be modified through this adaptor - /// by adding or removing nodes or arcs, unless the \c _Digraph template + /// by adding or removing nodes or arcs, unless the \c GR template /// parameter is set to be \c const. /// - /// \tparam _Digraph The type of the adapted digraph. + /// \tparam GR 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. - /// \tparam _ArcFilterMap A \c bool (or convertible) arc map of the - /// adapted digraph. The default map type is - /// \ref concepts::Digraph::ArcMap "_Digraph::ArcMap". + /// \tparam AF The type of the arc filter map. + /// It must be a \c bool (or convertible) arc map of the + /// adapted digraph. The default type is + /// \ref concepts::Digraph::ArcMap "GR::ArcMap". /// /// \note The \c Node and \c Arc types of this adaptor and the adapted /// digraph are convertible to each other. #ifdef DOXYGEN - template + template + class FilterArcs { #else - template > + template > + class FilterArcs : + public DigraphAdaptorExtender< + SubDigraphBase, AF, false> > { #endif - class FilterArcs : - public SubDigraph<_Digraph, ConstMap, - _ArcFilterMap, false> { public: - - typedef _Digraph Digraph; - typedef _ArcFilterMap ArcFilterMap; - - typedef SubDigraph, - ArcFilterMap, false> Parent; + /// The type of the adapted digraph. + typedef GR Digraph; + /// The type of the arc filter map. + typedef AF ArcFilterMap; + + typedef DigraphAdaptorExtender< + SubDigraphBase, AF, false> > + Parent; typedef typename Parent::Arc Arc; @@ -1709,16 +1698,16 @@ /// This function just returns a read-only \ref FilterArcs adaptor. /// \ingroup graph_adaptors /// \relates FilterArcs - template - FilterArcs - filterArcs(const Digraph& digraph, ArcFilterMap& afm) { - return FilterArcs(digraph, afm); + template + FilterArcs + filterArcs(const GR& digraph, AF& arc_filter_map) { + return FilterArcs(digraph, arc_filter_map); } - template - FilterArcs - filterArcs(const Digraph& digraph, const ArcFilterMap& afm) { - return FilterArcs(digraph, afm); + template + FilterArcs + filterArcs(const GR& digraph, const AF& arc_filter_map) { + return FilterArcs(digraph, arc_filter_map); } /// \ingroup graph_adaptors @@ -1732,34 +1721,42 @@ /// "Graph" concept. /// /// The adapted graph can also be modified through this adaptor - /// by adding or removing nodes or edges, unless the \c _Graph template + /// by adding or removing nodes or edges, unless the \c GR template /// parameter is set to be \c const. /// - /// \tparam _Graph The type of the adapted graph. + /// \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. - /// \tparam _EdgeFilterMap A \c bool (or convertible) edge map of the - /// adapted graph. The default map type is - /// \ref concepts::Graph::EdgeMap "_Graph::EdgeMap". + /// \tparam EF The type of the edge filter map. + /// It must be a \c bool (or convertible) edge map of the + /// adapted graph. The default type is + /// \ref concepts::Graph::EdgeMap "GR::EdgeMap". /// /// \note The \c Node, \c Edge and \c Arc types of this adaptor and the /// adapted graph are convertible to each other. #ifdef DOXYGEN - template + template + class FilterEdges { #else - template > + template > + class FilterEdges : + public GraphAdaptorExtender< + SubGraphBase, EF, false> > { #endif - class FilterEdges : - public SubGraph<_Graph, ConstMap, - _EdgeFilterMap, false> { public: - typedef _Graph Graph; - typedef _EdgeFilterMap EdgeFilterMap; - typedef SubGraph, - EdgeFilterMap, false> Parent; + /// The type of the adapted graph. + typedef GR Graph; + /// The type of the edge filter map. + typedef EF EdgeFilterMap; + + typedef GraphAdaptorExtender< + SubGraphBase, EF, false> > + Parent; + typedef typename Parent::Edge Edge; + protected: ConstMap const_true_map; @@ -1813,16 +1810,16 @@ /// This function just returns a read-only \ref FilterEdges adaptor. /// \ingroup graph_adaptors /// \relates FilterEdges - template - FilterEdges - filterEdges(const Graph& graph, EdgeFilterMap& efm) { - return FilterEdges(graph, efm); + template + FilterEdges + filterEdges(const GR& graph, EF& edge_filter_map) { + return FilterEdges(graph, edge_filter_map); } - template - FilterEdges - filterEdges(const Graph& graph, const EdgeFilterMap& efm) { - return FilterEdges(graph, efm); + template + FilterEdges + filterEdges(const GR& graph, const EF& edge_filter_map) { + return FilterEdges(graph, edge_filter_map); } @@ -2226,10 +2223,10 @@ /// This adaptor conforms to the \ref concepts::Graph "Graph" concept. /// /// The adapted digraph can also be modified through this adaptor - /// by adding or removing nodes or edges, unless the \c _Digraph template + /// by adding or removing nodes or edges, unless the \c GR template /// parameter is set to be \c const. /// - /// \tparam _Digraph The type of the adapted digraph. + /// \tparam GR 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. /// @@ -2239,12 +2236,17 @@ /// each other. /// (Thus the \c Arc type of the adaptor is convertible to the \c Arc type /// of the adapted digraph.) - template - class Undirector - : public GraphAdaptorExtender > { + template +#ifdef DOXYGEN + class Undirector { +#else + class Undirector : + public GraphAdaptorExtender > { +#endif public: - typedef _Digraph Digraph; - typedef GraphAdaptorExtender > Parent; + /// The type of the adapted digraph. + typedef GR Digraph; + typedef GraphAdaptorExtender > Parent; protected: Undirector() { } public: @@ -2252,7 +2254,7 @@ /// \brief Constructor /// /// Creates an undirected graph from the given digraph. - Undirector(_Digraph& digraph) { + Undirector(Digraph& digraph) { setDigraph(digraph); } @@ -2262,20 +2264,17 @@ /// digraph to get an arc map of the undirected graph. /// Its value type is inherited from the first arc map type /// (\c %ForwardMap). - template + template class CombinedArcMap { public: - typedef _ForwardMap ForwardMap; - typedef _BackwardMap BackwardMap; - - typedef typename MapTraits::ReferenceMapTag ReferenceMapTag; - /// The key type of the map typedef typename Parent::Arc Key; /// The value type of the map typedef typename ForwardMap::Value Value; + typedef typename MapTraits::ReferenceMapTag ReferenceMapTag; + typedef typename MapTraits::ReturnValue ReturnValue; typedef typename MapTraits::ConstReturnValue ConstReturnValue; typedef typename MapTraits::ReturnValue Reference; @@ -2356,10 +2355,9 @@ /// This function just returns a read-only \ref Undirector adaptor. /// \ingroup graph_adaptors /// \relates Undirector - template - Undirector - undirector(const Digraph& digraph) { - return Undirector(digraph); + template + Undirector undirector(const GR& digraph) { + return Undirector(digraph); } @@ -2533,38 +2531,39 @@ /// This class conforms to the \ref concepts::Digraph "Digraph" concept. /// /// The adapted graph can also be modified through this adaptor - /// by adding or removing nodes or arcs, unless the \c _Graph template + /// by adding or removing nodes or arcs, unless the \c GR template /// parameter is set to be \c const. /// - /// \tparam _Graph The type of the adapted graph. + /// \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. - /// \tparam _DirectionMap A \c bool (or convertible) edge map of the - /// adapted graph. The default map type is - /// \ref concepts::Graph::EdgeMap "_Graph::EdgeMap". + /// \tparam DM The type of the direction map. + /// It must be a \c bool (or convertible) edge map of the + /// adapted graph. The default type is + /// \ref concepts::Graph::EdgeMap "GR::EdgeMap". /// /// \note The \c Node type of this adaptor and the adapted graph are /// convertible to each other, moreover the \c Arc type of the adaptor /// and the \c Edge type of the adapted graph are also convertible to /// each other. #ifdef DOXYGEN - template + template + class Orienter { #else - template > + template > + class Orienter : + public DigraphAdaptorExtender > { #endif - class Orienter : - public DigraphAdaptorExtender > { public: /// The type of the adapted graph. - typedef _Graph Graph; + typedef GR Graph; /// The type of the direction edge map. - typedef _DirectionMap DirectionMap; - - typedef DigraphAdaptorExtender< - OrienterBase<_Graph, _DirectionMap> > Parent; + typedef DM DirectionMap; + + typedef DigraphAdaptorExtender > Parent; typedef typename Parent::Arc Arc; protected: Orienter() { } @@ -2593,32 +2592,27 @@ /// This function just returns a read-only \ref Orienter adaptor. /// \ingroup graph_adaptors /// \relates Orienter - template - Orienter - orienter(const Graph& graph, DirectionMap& dm) { - return Orienter(graph, dm); + template + Orienter + orienter(const GR& graph, DM& direction_map) { + return Orienter(graph, direction_map); } - template - Orienter - orienter(const Graph& graph, const DirectionMap& dm) { - return Orienter(graph, dm); + template + Orienter + orienter(const GR& graph, const DM& direction_map) { + return Orienter(graph, direction_map); } namespace _adaptor_bits { - template, - typename _FlowMap = _CapacityMap, - typename _Tolerance = Tolerance > + template class ResForwardFilter { public: - typedef _Digraph Digraph; - typedef _CapacityMap CapacityMap; - typedef _FlowMap FlowMap; - typedef _Tolerance Tolerance; - typedef typename Digraph::Arc Key; typedef bool Value; @@ -2638,18 +2632,13 @@ } }; - template, - typename _FlowMap = _CapacityMap, - typename _Tolerance = Tolerance > + template class ResBackwardFilter { public: - typedef _Digraph Digraph; - typedef _CapacityMap CapacityMap; - typedef _FlowMap FlowMap; - typedef _Tolerance Tolerance; - typedef typename Digraph::Arc Key; typedef bool Value; @@ -2692,17 +2681,18 @@ /// arcs). /// This class conforms to the \ref concepts::Digraph "Digraph" concept. /// - /// \tparam _Digraph The type of the adapted digraph. + /// \tparam GR The type of the adapted digraph. /// It must conform to the \ref concepts::Digraph "Digraph" concept. /// It is implicitly \c const. - /// \tparam _CapacityMap An arc map of some numerical type, which defines + /// \tparam CM The type of the capacity map. + /// It must be an arc map of some numerical type, which defines /// the capacities in the flow problem. It is implicitly \c const. - /// The default map type is - /// \ref concepts::Digraph::ArcMap "_Digraph::ArcMap". - /// \tparam _FlowMap An arc map of some numerical type, which defines - /// the flow values in the flow problem. - /// The default map type is \c _CapacityMap. - /// \tparam _Tolerance Tolerance type for handling inexact computation. + /// The default type is + /// \ref concepts::Digraph::ArcMap "GR::ArcMap". + /// \tparam FM The type of the flow map. + /// It must be an arc map of some numerical type, which defines + /// the flow values in the flow problem. The default type is \c CM. + /// \tparam TL The tolerance type for handling inexact computation. /// The default tolerance type depends on the value type of the /// capacity map. /// @@ -2713,35 +2703,31 @@ /// convertible to each other, moreover the \c Arc type of the adaptor /// is convertible to the \c Arc type of the adapted digraph. #ifdef DOXYGEN - template + template class Residual #else - template, - typename _FlowMap = _CapacityMap, - typename _Tolerance = Tolerance > + template, + typename FM = CM, + typename TL = Tolerance > class Residual : public FilterArcs< - Undirector, - typename Undirector::template CombinedArcMap< - _adaptor_bits::ResForwardFilter, - _adaptor_bits::ResBackwardFilter > > + Undirector, + typename Undirector::template CombinedArcMap< + _adaptor_bits::ResForwardFilter, + _adaptor_bits::ResBackwardFilter > > #endif { public: /// The type of the underlying digraph. - typedef _Digraph Digraph; + typedef GR Digraph; /// The type of the capacity map. - typedef _CapacityMap CapacityMap; + typedef CM CapacityMap; /// The type of the flow map. - typedef _FlowMap FlowMap; - typedef _Tolerance Tolerance; + typedef FM FlowMap; + /// The tolerance type. + typedef TL Tolerance; typedef typename CapacityMap::Value Value; typedef Residual Adaptor; @@ -2757,7 +2743,7 @@ FlowMap, Tolerance> BackwardFilter; typedef typename Undirected:: - template CombinedArcMap ArcFilter; + template CombinedArcMap ArcFilter; typedef FilterArcs Parent; @@ -2856,7 +2842,7 @@ /// The key type of the map typedef Arc Key; /// The value type of the map - typedef typename _CapacityMap::Value Value; + typedef typename CapacityMap::Value Value; /// Constructor ResidualCapacity(const Adaptor& adaptor) : _adaptor(&adaptor) {} @@ -2882,13 +2868,11 @@ /// This function just returns a (read-only) \ref Residual adaptor. /// \ingroup graph_adaptors /// \relates Residual - template - Residual - residual(const Digraph& digraph, - const CapacityMap& capacity, - FlowMap& flow) - { - return Residual (digraph, capacity, flow); + template + Residual residual(const GR& digraph, + const CM& capacity_map, + FM& flow_map) { + return Residual (digraph, capacity_map, flow_map); } @@ -3339,18 +3323,22 @@ /// costs/capacities of the original digraph to the \e bind \e arcs /// in the adaptor. /// - /// \tparam _Digraph The type of the adapted digraph. + /// \tparam GR The type of the adapted digraph. /// It must conform to the \ref concepts::Digraph "Digraph" concept. /// It is implicitly \c const. /// /// \note The \c Node type of this adaptor is converible to the \c Node /// type of the adapted digraph. - template + template +#ifdef DOXYGEN + class SplitNodes { +#else class SplitNodes - : public DigraphAdaptorExtender > { + : public DigraphAdaptorExtender > { +#endif public: - typedef _Digraph Digraph; - typedef DigraphAdaptorExtender > Parent; + typedef GR Digraph; + typedef DigraphAdaptorExtender > Parent; typedef typename Digraph::Node DigraphNode; typedef typename Digraph::Arc DigraphArc; @@ -3521,29 +3509,24 @@ /// This map adaptor class adapts an arc map and a node map of the /// original digraph to get an arc map of the split digraph. /// Its value type is inherited from the original arc map type - /// (\c DigraphArcMap). - template + /// (\c ArcMap). + template class CombinedArcMap { public: /// The key type of the map typedef Arc Key; /// The value type of the map - typedef typename DigraphArcMap::Value Value; - - typedef typename MapTraits::ReferenceMapTag - ReferenceMapTag; - typedef typename MapTraits::ReturnValue - ReturnValue; - typedef typename MapTraits::ConstReturnValue - ConstReturnValue; - typedef typename MapTraits::ReturnValue - Reference; - typedef typename MapTraits::ConstReturnValue - ConstReference; + typedef typename ArcMap::Value Value; + + typedef typename MapTraits::ReferenceMapTag ReferenceMapTag; + typedef typename MapTraits::ReturnValue ReturnValue; + typedef typename MapTraits::ConstReturnValue ConstReturnValue; + typedef typename MapTraits::ReturnValue Reference; + typedef typename MapTraits::ConstReturnValue ConstReference; /// Constructor - CombinedArcMap(DigraphArcMap& arc_map, DigraphNodeMap& node_map) + CombinedArcMap(ArcMap& arc_map, NodeMap& node_map) : _arc_map(arc_map), _node_map(node_map) {} /// Returns the value associated with the given key. @@ -3574,39 +3557,35 @@ } private: - DigraphArcMap& _arc_map; - DigraphNodeMap& _node_map; + ArcMap& _arc_map; + NodeMap& _node_map; }; /// \brief Returns a combined arc map /// /// This function just returns a combined arc map. - template - static CombinedArcMap - combinedArcMap(DigraphArcMap& arc_map, DigraphNodeMap& node_map) { - return CombinedArcMap(arc_map, node_map); + template + static CombinedArcMap + combinedArcMap(ArcMap& arc_map, NodeMap& node_map) { + return CombinedArcMap(arc_map, node_map); } - template - static CombinedArcMap - combinedArcMap(const DigraphArcMap& arc_map, DigraphNodeMap& node_map) { - return CombinedArcMap(arc_map, node_map); + template + static CombinedArcMap + combinedArcMap(const ArcMap& arc_map, NodeMap& node_map) { + return CombinedArcMap(arc_map, node_map); } - template - static CombinedArcMap - combinedArcMap(DigraphArcMap& arc_map, const DigraphNodeMap& node_map) { - return CombinedArcMap(arc_map, node_map); + template + static CombinedArcMap + combinedArcMap(ArcMap& arc_map, const NodeMap& node_map) { + return CombinedArcMap(arc_map, node_map); } - template - static CombinedArcMap - combinedArcMap(const DigraphArcMap& arc_map, - const DigraphNodeMap& node_map) { - return CombinedArcMap(arc_map, node_map); + template + static CombinedArcMap + combinedArcMap(const ArcMap& arc_map, const NodeMap& node_map) { + return CombinedArcMap(arc_map, node_map); } }; @@ -3616,13 +3595,12 @@ /// This function just returns a (read-only) \ref SplitNodes adaptor. /// \ingroup graph_adaptors /// \relates SplitNodes - template - SplitNodes - splitNodes(const Digraph& digraph) { - return SplitNodes(digraph); + template + SplitNodes + splitNodes(const GR& digraph) { + return SplitNodes(digraph); } - } //namespace lemon #endif //LEMON_ADAPTORS_H diff -r aea2dc0518ce -r c246659c8b19 lemon/bits/graph_adaptor_extender.h --- a/lemon/bits/graph_adaptor_extender.h Fri Jan 09 14:03:25 2009 +0100 +++ b/lemon/bits/graph_adaptor_extender.h Sun Jan 11 15:24:20 2009 +0100 @@ -173,10 +173,6 @@ }; - - /// \ingroup digraphbits - /// - /// \brief Extender for the GraphAdaptors template class GraphAdaptorExtender : public _Graph { public: