# HG changeset patch # User Balazs Dezso # Date 1234528168 -3600 # Node ID 9b9ffe7d9b75d733823b3a050edc5f387a80b634 # Parent 861a9d5ff283ec024491304718018dc4b7ed4b0b Fixes for MSVC 2008 in grap_adaptors.h and edge_set.h (#194) Several renamings and changes in adaptors and edge sets - Fixing scope usage for MSVC - ResidualDigraph based on SubDigraph instead of FilterArcs - Use initialize() in adaptors and edge sets - Wrap ListDigraph for edge set tests diff -r 861a9d5ff283 -r 9b9ffe7d9b75 lemon/adaptors.h --- a/lemon/adaptors.h Fri Jan 23 16:42:07 2009 +0000 +++ b/lemon/adaptors.h Fri Feb 13 13:29:28 2009 +0100 @@ -36,23 +36,28 @@ namespace lemon { - template +#ifdef _MSC_VER +#define LEMON_SCOPE_FIX(OUTER, NESTED) OUTER::NESTED +#else +#define LEMON_SCOPE_FIX(OUTER, NESTED) typename OUTER::template NESTED +#endif + + template class DigraphAdaptorBase { public: - typedef _Digraph Digraph; + typedef DGR Digraph; typedef DigraphAdaptorBase Adaptor; - typedef Digraph ParentDigraph; protected: - Digraph* _digraph; + DGR* _digraph; DigraphAdaptorBase() : _digraph(0) { } - void setDigraph(Digraph& digraph) { _digraph = &digraph; } + void initialize(DGR& digraph) { _digraph = &digraph; } public: - DigraphAdaptorBase(Digraph& digraph) : _digraph(&digraph) { } - - typedef typename Digraph::Node Node; - typedef typename Digraph::Arc Arc; + DigraphAdaptorBase(DGR& digraph) : _digraph(&digraph) { } + + typedef typename DGR::Node Node; + typedef typename DGR::Arc Arc; void first(Node& i) const { _digraph->first(i); } void first(Arc& i) const { _digraph->first(i); } @@ -67,13 +72,13 @@ Node source(const Arc& a) const { return _digraph->source(a); } Node target(const Arc& a) const { return _digraph->target(a); } - typedef NodeNumTagIndicator NodeNumTag; + typedef NodeNumTagIndicator NodeNumTag; int nodeNum() const { return _digraph->nodeNum(); } - typedef ArcNumTagIndicator ArcNumTag; + typedef ArcNumTagIndicator ArcNumTag; int arcNum() const { return _digraph->arcNum(); } - typedef FindArcTagIndicator FindArcTag; + typedef FindArcTagIndicator FindArcTag; Arc findArc(const Node& u, const Node& v, const Arc& prev = INVALID) const { return _digraph->findArc(u, v, prev); } @@ -95,22 +100,22 @@ int maxNodeId() const { return _digraph->maxNodeId(); } int maxArcId() const { return _digraph->maxArcId(); } - typedef typename ItemSetTraits::ItemNotifier NodeNotifier; + typedef typename ItemSetTraits::ItemNotifier NodeNotifier; NodeNotifier& notifier(Node) const { return _digraph->notifier(Node()); } - typedef typename ItemSetTraits::ItemNotifier ArcNotifier; + typedef typename ItemSetTraits::ItemNotifier ArcNotifier; ArcNotifier& notifier(Arc) const { return _digraph->notifier(Arc()); } - template - class NodeMap : public Digraph::template NodeMap<_Value> { + template + class NodeMap : public DGR::template NodeMap { public: - typedef typename Digraph::template NodeMap<_Value> Parent; + typedef typename DGR::template NodeMap Parent; explicit NodeMap(const Adaptor& adaptor) : Parent(*adaptor._digraph) {} - NodeMap(const Adaptor& adaptor, const _Value& value) + NodeMap(const Adaptor& adaptor, const V& value) : Parent(*adaptor._digraph, value) { } private: @@ -126,16 +131,16 @@ }; - template - class ArcMap : public Digraph::template ArcMap<_Value> { + template + class ArcMap : public DGR::template ArcMap { public: - typedef typename Digraph::template ArcMap<_Value> Parent; - - explicit ArcMap(const Adaptor& adaptor) + typedef typename DGR::template ArcMap Parent; + + explicit ArcMap(const DigraphAdaptorBase& adaptor) : Parent(*adaptor._digraph) {} - ArcMap(const Adaptor& adaptor, const _Value& value) + ArcMap(const DigraphAdaptorBase& adaptor, const V& value) : Parent(*adaptor._digraph, value) {} private: @@ -153,25 +158,24 @@ }; - template + template class GraphAdaptorBase { public: - typedef _Graph Graph; - typedef Graph ParentGraph; + typedef GR Graph; protected: - Graph* _graph; + GR* _graph; GraphAdaptorBase() : _graph(0) {} - void setGraph(Graph& graph) { _graph = &graph; } + void initialize(GR& graph) { _graph = &graph; } public: - GraphAdaptorBase(Graph& graph) : _graph(&graph) {} - - typedef typename Graph::Node Node; - typedef typename Graph::Arc Arc; - typedef typename Graph::Edge Edge; + GraphAdaptorBase(GR& graph) : _graph(&graph) {} + + typedef typename GR::Node Node; + typedef typename GR::Arc Arc; + typedef typename GR::Edge Edge; void first(Node& i) const { _graph->first(i); } void first(Arc& i) const { _graph->first(i); } @@ -239,22 +243,22 @@ int maxArcId() const { return _graph->maxArcId(); } int maxEdgeId() const { return _graph->maxEdgeId(); } - typedef typename ItemSetTraits::ItemNotifier NodeNotifier; + typedef typename ItemSetTraits::ItemNotifier NodeNotifier; NodeNotifier& notifier(Node) const { return _graph->notifier(Node()); } - typedef typename ItemSetTraits::ItemNotifier ArcNotifier; + typedef typename ItemSetTraits::ItemNotifier ArcNotifier; ArcNotifier& notifier(Arc) const { return _graph->notifier(Arc()); } - typedef typename ItemSetTraits::ItemNotifier EdgeNotifier; + typedef typename ItemSetTraits::ItemNotifier EdgeNotifier; EdgeNotifier& notifier(Edge) const { return _graph->notifier(Edge()); } - template - class NodeMap : public Graph::template NodeMap<_Value> { + template + class NodeMap : public GR::template NodeMap { public: - typedef typename Graph::template NodeMap<_Value> Parent; - explicit NodeMap(const GraphAdaptorBase& adapter) + typedef typename GR::template NodeMap Parent; + explicit NodeMap(const GraphAdaptorBase& adapter) : Parent(*adapter._graph) {} - NodeMap(const GraphAdaptorBase& adapter, const _Value& value) + NodeMap(const GraphAdaptorBase& adapter, const V& value) : Parent(*adapter._graph, value) {} private: @@ -270,13 +274,13 @@ }; - template - class ArcMap : public Graph::template ArcMap<_Value> { + template + class ArcMap : public GR::template ArcMap { public: - typedef typename Graph::template ArcMap<_Value> Parent; - explicit ArcMap(const GraphAdaptorBase& adapter) + typedef typename GR::template ArcMap Parent; + explicit ArcMap(const GraphAdaptorBase& adapter) : Parent(*adapter._graph) {} - ArcMap(const GraphAdaptorBase& adapter, const _Value& value) + ArcMap(const GraphAdaptorBase& adapter, const V& value) : Parent(*adapter._graph, value) {} private: @@ -291,13 +295,13 @@ } }; - template - class EdgeMap : public Graph::template EdgeMap<_Value> { + template + class EdgeMap : public GR::template EdgeMap { public: - typedef typename Graph::template EdgeMap<_Value> Parent; - explicit EdgeMap(const GraphAdaptorBase& adapter) + typedef typename GR::template EdgeMap Parent; + explicit EdgeMap(const GraphAdaptorBase& adapter) : Parent(*adapter._graph) {} - EdgeMap(const GraphAdaptorBase& adapter, const _Value& value) + EdgeMap(const GraphAdaptorBase& adapter, const V& value) : Parent(*adapter._graph, value) {} private: @@ -314,11 +318,11 @@ }; - template - class ReverseDigraphBase : public DigraphAdaptorBase<_Digraph> { + template + class ReverseDigraphBase : public DigraphAdaptorBase { public: - typedef _Digraph Digraph; - typedef DigraphAdaptorBase<_Digraph> Parent; + typedef DGR Digraph; + typedef DigraphAdaptorBase Parent; protected: ReverseDigraphBase() : Parent() { } public: @@ -336,7 +340,7 @@ Arc addArc(const Node& u, const Node& v) { return Parent::addArc(v, u); } - typedef FindArcTagIndicator FindArcTag; + typedef FindArcTagIndicator FindArcTag; Arc findArc(const Node& u, const Node& v, const Arc& prev = INVALID) const { return Parent::findArc(v, u, prev); @@ -356,23 +360,23 @@ /// by adding or removing nodes or arcs, unless the \c GR template /// parameter is set to be \c const. /// - /// \tparam GR The type of the adapted digraph. + /// \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. /// /// \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: /// The type of the adapted digraph. - typedef GR Digraph; - typedef DigraphAdaptorExtender > Parent; + typedef DGR Digraph; + typedef DigraphAdaptorExtender > Parent; protected: ReverseDigraph() { } public: @@ -380,8 +384,8 @@ /// \brief Constructor /// /// Creates a reverse digraph adaptor for the given digraph. - explicit ReverseDigraph(Digraph& digraph) { - Parent::setDigraph(digraph); + explicit ReverseDigraph(DGR& digraph) { + Parent::initialize(digraph); } }; @@ -390,33 +394,31 @@ /// This function just returns a read-only \ref ReverseDigraph adaptor. /// \ingroup graph_adaptors /// \relates ReverseDigraph - template - ReverseDigraph reverseDigraph(const GR& digraph) { - return ReverseDigraph(digraph); + template + ReverseDigraph reverseDigraph(const DGR& digraph) { + return ReverseDigraph(digraph); } - template - class SubDigraphBase : public DigraphAdaptorBase<_Digraph> { + template + class SubDigraphBase : public DigraphAdaptorBase { public: - typedef _Digraph Digraph; - typedef _NodeFilterMap NodeFilterMap; - typedef _ArcFilterMap ArcFilterMap; + typedef DGR Digraph; + typedef NF NodeFilterMap; + typedef AF ArcFilterMap; typedef SubDigraphBase Adaptor; - typedef DigraphAdaptorBase<_Digraph> Parent; + typedef DigraphAdaptorBase Parent; protected: - NodeFilterMap* _node_filter; - ArcFilterMap* _arc_filter; + NF* _node_filter; + AF* _arc_filter; SubDigraphBase() : Parent(), _node_filter(0), _arc_filter(0) { } - void setNodeFilterMap(NodeFilterMap& node_filter) { + void initialize(DGR& digraph, NF& node_filter, AF& arc_filter) { + Parent::initialize(digraph); _node_filter = &node_filter; - } - void setArcFilterMap(ArcFilterMap& arc_filter) { - _arc_filter = &arc_filter; + _arc_filter = &arc_filter; } public: @@ -487,7 +489,7 @@ typedef False NodeNumTag; typedef False ArcNumTag; - typedef FindArcTagIndicator FindArcTag; + typedef FindArcTagIndicator FindArcTag; Arc findArc(const Node& source, const Node& target, const Arc& prev = INVALID) const { if (!(*_node_filter)[source] || !(*_node_filter)[target]) { @@ -500,18 +502,21 @@ return arc; } - template - class NodeMap : public SubMapExtender > { + public: + + template + class NodeMap + : public SubMapExtender, + LEMON_SCOPE_FIX(DigraphAdaptorBase, NodeMap)> { public: - typedef _Value Value; - typedef SubMapExtender > MapParent; - - NodeMap(const Adaptor& adaptor) - : MapParent(adaptor) {} - NodeMap(const Adaptor& adaptor, const Value& value) - : MapParent(adaptor, value) {} + typedef V Value; + typedef SubMapExtender, + LEMON_SCOPE_FIX(DigraphAdaptorBase, NodeMap)> Parent; + + NodeMap(const SubDigraphBase& adaptor) + : Parent(adaptor) {} + NodeMap(const SubDigraphBase& adaptor, const V& value) + : Parent(adaptor, value) {} private: NodeMap& operator=(const NodeMap& cmap) { @@ -520,23 +525,24 @@ template NodeMap& operator=(const CMap& cmap) { - MapParent::operator=(cmap); + Parent::operator=(cmap); return *this; } }; - template - class ArcMap : public SubMapExtender > { + template + class ArcMap + : public SubMapExtender, + LEMON_SCOPE_FIX(DigraphAdaptorBase, ArcMap)> { public: - typedef _Value Value; - typedef SubMapExtender > MapParent; - - ArcMap(const Adaptor& adaptor) - : MapParent(adaptor) {} - ArcMap(const Adaptor& adaptor, const Value& value) - : MapParent(adaptor, value) {} + typedef V Value; + typedef SubMapExtender, + LEMON_SCOPE_FIX(DigraphAdaptorBase, ArcMap)> Parent; + + ArcMap(const SubDigraphBase& adaptor) + : Parent(adaptor) {} + ArcMap(const SubDigraphBase& adaptor, const V& value) + : Parent(adaptor, value) {} private: ArcMap& operator=(const ArcMap& cmap) { @@ -545,34 +551,33 @@ template ArcMap& operator=(const CMap& cmap) { - MapParent::operator=(cmap); + Parent::operator=(cmap); return *this; } }; }; - template - class SubDigraphBase<_Digraph, _NodeFilterMap, _ArcFilterMap, false> - : public DigraphAdaptorBase<_Digraph> { + template + class SubDigraphBase + : public DigraphAdaptorBase { public: - typedef _Digraph Digraph; - typedef _NodeFilterMap NodeFilterMap; - typedef _ArcFilterMap ArcFilterMap; + typedef DGR Digraph; + typedef NF NodeFilterMap; + typedef AF ArcFilterMap; typedef SubDigraphBase Adaptor; typedef DigraphAdaptorBase Parent; protected: - NodeFilterMap* _node_filter; - ArcFilterMap* _arc_filter; + NF* _node_filter; + AF* _arc_filter; SubDigraphBase() : Parent(), _node_filter(0), _arc_filter(0) { } - void setNodeFilterMap(NodeFilterMap& node_filter) { + void initialize(DGR& digraph, NF& node_filter, AF& arc_filter) { + Parent::initialize(digraph); _node_filter = &node_filter; - } - void setArcFilterMap(ArcFilterMap& arc_filter) { - _arc_filter = &arc_filter; + _arc_filter = &arc_filter; } public: @@ -627,7 +632,7 @@ typedef False NodeNumTag; typedef False ArcNumTag; - typedef FindArcTagIndicator FindArcTag; + typedef FindArcTagIndicator FindArcTag; Arc findArc(const Node& source, const Node& target, const Arc& prev = INVALID) const { if (!(*_node_filter)[source] || !(*_node_filter)[target]) { @@ -640,18 +645,19 @@ return arc; } - template - class NodeMap : public SubMapExtender > { + template + class NodeMap + : public SubMapExtender, + LEMON_SCOPE_FIX(DigraphAdaptorBase, NodeMap)> { public: - typedef _Value Value; - typedef SubMapExtender > MapParent; - - NodeMap(const Adaptor& adaptor) - : MapParent(adaptor) {} - NodeMap(const Adaptor& adaptor, const Value& value) - : MapParent(adaptor, value) {} + typedef V Value; + typedef SubMapExtender, + LEMON_SCOPE_FIX(DigraphAdaptorBase, NodeMap)> Parent; + + NodeMap(const SubDigraphBase& adaptor) + : Parent(adaptor) {} + NodeMap(const SubDigraphBase& adaptor, const V& value) + : Parent(adaptor, value) {} private: NodeMap& operator=(const NodeMap& cmap) { @@ -660,23 +666,24 @@ template NodeMap& operator=(const CMap& cmap) { - MapParent::operator=(cmap); + Parent::operator=(cmap); return *this; } }; - template - class ArcMap : public SubMapExtender > { + template + class ArcMap + : public SubMapExtender, + LEMON_SCOPE_FIX(DigraphAdaptorBase, ArcMap)> { public: - typedef _Value Value; - typedef SubMapExtender > MapParent; - - ArcMap(const Adaptor& adaptor) - : MapParent(adaptor) {} - ArcMap(const Adaptor& adaptor, const Value& value) - : MapParent(adaptor, value) {} + typedef V Value; + typedef SubMapExtender, + LEMON_SCOPE_FIX(DigraphAdaptorBase, ArcMap)> Parent; + + ArcMap(const SubDigraphBase& adaptor) + : Parent(adaptor) {} + ArcMap(const SubDigraphBase& adaptor, const V& value) + : Parent(adaptor, value) {} private: ArcMap& operator=(const ArcMap& cmap) { @@ -685,7 +692,7 @@ template ArcMap& operator=(const CMap& cmap) { - MapParent::operator=(cmap); + Parent::operator=(cmap); return *this; } }; @@ -708,17 +715,17 @@ /// by adding or removing nodes or arcs, unless the \c GR template /// parameter is set to be \c const. /// - /// \tparam GR The type of the adapted digraph. + /// \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. /// \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". + /// \ref concepts::Digraph::NodeMap "DGR::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". + /// \ref concepts::Digraph::ArcMap "DGR::ArcMap". /// /// \note The \c Node and \c Arc types of this adaptor and the adapted /// digraph are convertible to each other. @@ -726,24 +733,24 @@ /// \see FilterNodes /// \see FilterArcs #ifdef DOXYGEN - template + template class SubDigraph { #else - template, - typename AF = typename GR::template ArcMap > + template, + typename AF = typename DGR::template ArcMap > class SubDigraph : - public DigraphAdaptorExtender > { + public DigraphAdaptorExtender > { #endif public: /// The type of the adapted digraph. - typedef GR Digraph; + typedef DGR Digraph; /// The type of the node filter map. typedef NF NodeFilterMap; /// The type of the arc filter map. typedef AF ArcFilterMap; - typedef DigraphAdaptorExtender > + typedef DigraphAdaptorExtender > Parent; typedef typename Parent::Node Node; @@ -757,11 +764,8 @@ /// /// Creates a subdigraph for the given digraph with the /// given node and arc filter maps. - SubDigraph(Digraph& digraph, NodeFilterMap& node_filter, - ArcFilterMap& arc_filter) { - setDigraph(digraph); - setNodeFilterMap(node_filter); - setArcFilterMap(arc_filter); + SubDigraph(DGR& digraph, NF& node_filter, AF& arc_filter) { + Parent::initialize(digraph, node_filter, arc_filter); } /// \brief Sets the status of the given node @@ -823,62 +827,60 @@ /// This function just returns a read-only \ref SubDigraph adaptor. /// \ingroup graph_adaptors /// \relates SubDigraph - 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 DGR& digraph, + NF& node_filter, AF& arc_filter) { + return SubDigraph + (digraph, node_filter, arc_filter); } - 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 DGR& digraph, + const NF& node_filter, AF& arc_filter) { + return SubDigraph + (digraph, node_filter, arc_filter); } - 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 DGR& digraph, + NF& node_filter, const AF& arc_filter) { + return SubDigraph + (digraph, node_filter, arc_filter); } - 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); + template + SubDigraph + subDigraph(const DGR& digraph, + const NF& node_filter, const AF& arc_filter) { + return SubDigraph + (digraph, node_filter, arc_filter); } - template - class SubGraphBase : public GraphAdaptorBase<_Graph> { + template + class SubGraphBase : public GraphAdaptorBase { public: - typedef _Graph Graph; - typedef _NodeFilterMap NodeFilterMap; - typedef _EdgeFilterMap EdgeFilterMap; + typedef GR Graph; + typedef NF NodeFilterMap; + typedef EF EdgeFilterMap; typedef SubGraphBase Adaptor; - typedef GraphAdaptorBase<_Graph> Parent; + typedef GraphAdaptorBase Parent; protected: - NodeFilterMap* _node_filter_map; - EdgeFilterMap* _edge_filter_map; + NF* _node_filter; + EF* _edge_filter; SubGraphBase() - : Parent(), _node_filter_map(0), _edge_filter_map(0) { } - - void setNodeFilterMap(NodeFilterMap& node_filter_map) { - _node_filter_map=&node_filter_map; - } - void setEdgeFilterMap(EdgeFilterMap& edge_filter_map) { - _edge_filter_map=&edge_filter_map; + : Parent(), _node_filter(0), _edge_filter(0) { } + + void initialize(GR& graph, NF& node_filter, EF& edge_filter) { + Parent::initialize(graph); + _node_filter = &node_filter; + _edge_filter = &edge_filter; } public: @@ -889,95 +891,95 @@ void first(Node& i) const { Parent::first(i); - while (i!=INVALID && !(*_node_filter_map)[i]) Parent::next(i); + while (i!=INVALID && !(*_node_filter)[i]) Parent::next(i); } void first(Arc& i) const { Parent::first(i); - while (i!=INVALID && (!(*_edge_filter_map)[i] - || !(*_node_filter_map)[Parent::source(i)] - || !(*_node_filter_map)[Parent::target(i)])) + while (i!=INVALID && (!(*_edge_filter)[i] + || !(*_node_filter)[Parent::source(i)] + || !(*_node_filter)[Parent::target(i)])) Parent::next(i); } void first(Edge& i) const { Parent::first(i); - while (i!=INVALID && (!(*_edge_filter_map)[i] - || !(*_node_filter_map)[Parent::u(i)] - || !(*_node_filter_map)[Parent::v(i)])) + while (i!=INVALID && (!(*_edge_filter)[i] + || !(*_node_filter)[Parent::u(i)] + || !(*_node_filter)[Parent::v(i)])) Parent::next(i); } void firstIn(Arc& i, const Node& n) const { Parent::firstIn(i, n); - while (i!=INVALID && (!(*_edge_filter_map)[i] - || !(*_node_filter_map)[Parent::source(i)])) + while (i!=INVALID && (!(*_edge_filter)[i] + || !(*_node_filter)[Parent::source(i)])) Parent::nextIn(i); } void firstOut(Arc& i, const Node& n) const { Parent::firstOut(i, n); - while (i!=INVALID && (!(*_edge_filter_map)[i] - || !(*_node_filter_map)[Parent::target(i)])) + while (i!=INVALID && (!(*_edge_filter)[i] + || !(*_node_filter)[Parent::target(i)])) Parent::nextOut(i); } void firstInc(Edge& i, bool& d, const Node& n) const { Parent::firstInc(i, d, n); - while (i!=INVALID && (!(*_edge_filter_map)[i] - || !(*_node_filter_map)[Parent::u(i)] - || !(*_node_filter_map)[Parent::v(i)])) + while (i!=INVALID && (!(*_edge_filter)[i] + || !(*_node_filter)[Parent::u(i)] + || !(*_node_filter)[Parent::v(i)])) Parent::nextInc(i, d); } void next(Node& i) const { Parent::next(i); - while (i!=INVALID && !(*_node_filter_map)[i]) Parent::next(i); + while (i!=INVALID && !(*_node_filter)[i]) Parent::next(i); } void next(Arc& i) const { Parent::next(i); - while (i!=INVALID && (!(*_edge_filter_map)[i] - || !(*_node_filter_map)[Parent::source(i)] - || !(*_node_filter_map)[Parent::target(i)])) + while (i!=INVALID && (!(*_edge_filter)[i] + || !(*_node_filter)[Parent::source(i)] + || !(*_node_filter)[Parent::target(i)])) Parent::next(i); } void next(Edge& i) const { Parent::next(i); - while (i!=INVALID && (!(*_edge_filter_map)[i] - || !(*_node_filter_map)[Parent::u(i)] - || !(*_node_filter_map)[Parent::v(i)])) + while (i!=INVALID && (!(*_edge_filter)[i] + || !(*_node_filter)[Parent::u(i)] + || !(*_node_filter)[Parent::v(i)])) Parent::next(i); } void nextIn(Arc& i) const { Parent::nextIn(i); - while (i!=INVALID && (!(*_edge_filter_map)[i] - || !(*_node_filter_map)[Parent::source(i)])) + while (i!=INVALID && (!(*_edge_filter)[i] + || !(*_node_filter)[Parent::source(i)])) Parent::nextIn(i); } void nextOut(Arc& i) const { Parent::nextOut(i); - while (i!=INVALID && (!(*_edge_filter_map)[i] - || !(*_node_filter_map)[Parent::target(i)])) + while (i!=INVALID && (!(*_edge_filter)[i] + || !(*_node_filter)[Parent::target(i)])) Parent::nextOut(i); } void nextInc(Edge& i, bool& d) const { Parent::nextInc(i, d); - while (i!=INVALID && (!(*_edge_filter_map)[i] - || !(*_node_filter_map)[Parent::u(i)] - || !(*_node_filter_map)[Parent::v(i)])) + while (i!=INVALID && (!(*_edge_filter)[i] + || !(*_node_filter)[Parent::u(i)] + || !(*_node_filter)[Parent::v(i)])) Parent::nextInc(i, d); } - void status(const Node& n, bool v) const { _node_filter_map->set(n, v); } - void status(const Edge& e, bool v) const { _edge_filter_map->set(e, v); } - - bool status(const Node& n) const { return (*_node_filter_map)[n]; } - bool status(const Edge& e) const { return (*_edge_filter_map)[e]; } + void status(const Node& n, bool v) const { _node_filter->set(n, v); } + void status(const Edge& e, bool v) const { _edge_filter->set(e, v); } + + bool status(const Node& n) const { return (*_node_filter)[n]; } + bool status(const Edge& e) const { return (*_edge_filter)[e]; } typedef False NodeNumTag; typedef False ArcNumTag; @@ -986,11 +988,11 @@ typedef FindArcTagIndicator FindArcTag; Arc findArc(const Node& u, const Node& v, const Arc& prev = INVALID) const { - if (!(*_node_filter_map)[u] || !(*_node_filter_map)[v]) { + if (!(*_node_filter)[u] || !(*_node_filter)[v]) { return INVALID; } Arc arc = Parent::findArc(u, v, prev); - while (arc != INVALID && !(*_edge_filter_map)[arc]) { + while (arc != INVALID && !(*_edge_filter)[arc]) { arc = Parent::findArc(u, v, arc); } return arc; @@ -999,28 +1001,29 @@ typedef FindEdgeTagIndicator FindEdgeTag; Edge findEdge(const Node& u, const Node& v, const Edge& prev = INVALID) const { - if (!(*_node_filter_map)[u] || !(*_node_filter_map)[v]) { + if (!(*_node_filter)[u] || !(*_node_filter)[v]) { return INVALID; } Edge edge = Parent::findEdge(u, v, prev); - while (edge != INVALID && !(*_edge_filter_map)[edge]) { + while (edge != INVALID && !(*_edge_filter)[edge]) { edge = Parent::findEdge(u, v, edge); } return edge; } - template - class NodeMap : public SubMapExtender > { + template + class NodeMap + : public SubMapExtender, + LEMON_SCOPE_FIX(GraphAdaptorBase, NodeMap)> { public: - typedef _Value Value; - typedef SubMapExtender > MapParent; - - NodeMap(const Adaptor& adaptor) - : MapParent(adaptor) {} - NodeMap(const Adaptor& adaptor, const Value& value) - : MapParent(adaptor, value) {} + typedef V Value; + typedef SubMapExtender, + LEMON_SCOPE_FIX(GraphAdaptorBase, NodeMap)> Parent; + + NodeMap(const SubGraphBase& adaptor) + : Parent(adaptor) {} + NodeMap(const SubGraphBase& adaptor, const V& value) + : Parent(adaptor, value) {} private: NodeMap& operator=(const NodeMap& cmap) { @@ -1029,23 +1032,24 @@ template NodeMap& operator=(const CMap& cmap) { - MapParent::operator=(cmap); + Parent::operator=(cmap); return *this; } }; - template - class ArcMap : public SubMapExtender > { + template + class ArcMap + : public SubMapExtender, + LEMON_SCOPE_FIX(GraphAdaptorBase, ArcMap)> { public: - typedef _Value Value; - typedef SubMapExtender > MapParent; - - ArcMap(const Adaptor& adaptor) - : MapParent(adaptor) {} - ArcMap(const Adaptor& adaptor, const Value& value) - : MapParent(adaptor, value) {} + typedef V Value; + typedef SubMapExtender, + LEMON_SCOPE_FIX(GraphAdaptorBase, ArcMap)> Parent; + + ArcMap(const SubGraphBase& adaptor) + : Parent(adaptor) {} + ArcMap(const SubGraphBase& adaptor, const V& value) + : Parent(adaptor, value) {} private: ArcMap& operator=(const ArcMap& cmap) { @@ -1054,24 +1058,25 @@ template ArcMap& operator=(const CMap& cmap) { - MapParent::operator=(cmap); + Parent::operator=(cmap); return *this; } }; - template - class EdgeMap : public SubMapExtender > { + template + class EdgeMap + : public SubMapExtender, + LEMON_SCOPE_FIX(GraphAdaptorBase, EdgeMap)> { public: - typedef _Value Value; - typedef SubMapExtender > MapParent; - - EdgeMap(const Adaptor& adaptor) - : MapParent(adaptor) {} - - EdgeMap(const Adaptor& adaptor, const Value& value) - : MapParent(adaptor, value) {} + typedef V Value; + typedef SubMapExtender, + LEMON_SCOPE_FIX(GraphAdaptorBase, EdgeMap)> Parent; + + EdgeMap(const SubGraphBase& adaptor) + : Parent(adaptor) {} + + EdgeMap(const SubGraphBase& adaptor, const V& value) + : Parent(adaptor, value) {} private: EdgeMap& operator=(const EdgeMap& cmap) { @@ -1080,34 +1085,33 @@ template EdgeMap& operator=(const CMap& cmap) { - MapParent::operator=(cmap); + Parent::operator=(cmap); return *this; } }; }; - template - class SubGraphBase<_Graph, _NodeFilterMap, _EdgeFilterMap, false> - : public GraphAdaptorBase<_Graph> { + template + class SubGraphBase + : public GraphAdaptorBase { public: - typedef _Graph Graph; - typedef _NodeFilterMap NodeFilterMap; - typedef _EdgeFilterMap EdgeFilterMap; + typedef GR Graph; + typedef NF NodeFilterMap; + typedef EF EdgeFilterMap; typedef SubGraphBase Adaptor; - typedef GraphAdaptorBase<_Graph> Parent; + typedef GraphAdaptorBase Parent; protected: - NodeFilterMap* _node_filter_map; - EdgeFilterMap* _edge_filter_map; - SubGraphBase() : Parent(), - _node_filter_map(0), _edge_filter_map(0) { } - - void setNodeFilterMap(NodeFilterMap& node_filter_map) { - _node_filter_map=&node_filter_map; - } - void setEdgeFilterMap(EdgeFilterMap& edge_filter_map) { - _edge_filter_map=&edge_filter_map; + NF* _node_filter; + EF* _edge_filter; + SubGraphBase() + : Parent(), _node_filter(0), _edge_filter(0) { } + + void initialize(GR& graph, NF& node_filter, EF& edge_filter) { + Parent::initialize(graph); + _node_filter = &node_filter; + _edge_filter = &edge_filter; } public: @@ -1118,65 +1122,65 @@ void first(Node& i) const { Parent::first(i); - while (i!=INVALID && !(*_node_filter_map)[i]) Parent::next(i); + while (i!=INVALID && !(*_node_filter)[i]) Parent::next(i); } void first(Arc& i) const { Parent::first(i); - while (i!=INVALID && !(*_edge_filter_map)[i]) Parent::next(i); + while (i!=INVALID && !(*_edge_filter)[i]) Parent::next(i); } void first(Edge& i) const { Parent::first(i); - while (i!=INVALID && !(*_edge_filter_map)[i]) Parent::next(i); + while (i!=INVALID && !(*_edge_filter)[i]) Parent::next(i); } void firstIn(Arc& i, const Node& n) const { Parent::firstIn(i, n); - while (i!=INVALID && !(*_edge_filter_map)[i]) Parent::nextIn(i); + while (i!=INVALID && !(*_edge_filter)[i]) Parent::nextIn(i); } void firstOut(Arc& i, const Node& n) const { Parent::firstOut(i, n); - while (i!=INVALID && !(*_edge_filter_map)[i]) Parent::nextOut(i); + while (i!=INVALID && !(*_edge_filter)[i]) Parent::nextOut(i); } void firstInc(Edge& i, bool& d, const Node& n) const { Parent::firstInc(i, d, n); - while (i!=INVALID && !(*_edge_filter_map)[i]) Parent::nextInc(i, d); + while (i!=INVALID && !(*_edge_filter)[i]) Parent::nextInc(i, d); } void next(Node& i) const { Parent::next(i); - while (i!=INVALID && !(*_node_filter_map)[i]) Parent::next(i); + while (i!=INVALID && !(*_node_filter)[i]) Parent::next(i); } void next(Arc& i) const { Parent::next(i); - while (i!=INVALID && !(*_edge_filter_map)[i]) Parent::next(i); + while (i!=INVALID && !(*_edge_filter)[i]) Parent::next(i); } void next(Edge& i) const { Parent::next(i); - while (i!=INVALID && !(*_edge_filter_map)[i]) Parent::next(i); + while (i!=INVALID && !(*_edge_filter)[i]) Parent::next(i); } void nextIn(Arc& i) const { Parent::nextIn(i); - while (i!=INVALID && !(*_edge_filter_map)[i]) Parent::nextIn(i); + while (i!=INVALID && !(*_edge_filter)[i]) Parent::nextIn(i); } void nextOut(Arc& i) const { Parent::nextOut(i); - while (i!=INVALID && !(*_edge_filter_map)[i]) Parent::nextOut(i); + while (i!=INVALID && !(*_edge_filter)[i]) Parent::nextOut(i); } void nextInc(Edge& i, bool& d) const { Parent::nextInc(i, d); - while (i!=INVALID && !(*_edge_filter_map)[i]) Parent::nextInc(i, d); + while (i!=INVALID && !(*_edge_filter)[i]) Parent::nextInc(i, d); } - void status(const Node& n, bool v) const { _node_filter_map->set(n, v); } - void status(const Edge& e, bool v) const { _edge_filter_map->set(e, v); } - - bool status(const Node& n) const { return (*_node_filter_map)[n]; } - bool status(const Edge& e) const { return (*_edge_filter_map)[e]; } + void status(const Node& n, bool v) const { _node_filter->set(n, v); } + void status(const Edge& e, bool v) const { _edge_filter->set(e, v); } + + bool status(const Node& n) const { return (*_node_filter)[n]; } + bool status(const Edge& e) const { return (*_edge_filter)[e]; } typedef False NodeNumTag; typedef False ArcNumTag; @@ -1186,7 +1190,7 @@ Arc findArc(const Node& u, const Node& v, const Arc& prev = INVALID) const { Arc arc = Parent::findArc(u, v, prev); - while (arc != INVALID && !(*_edge_filter_map)[arc]) { + while (arc != INVALID && !(*_edge_filter)[arc]) { arc = Parent::findArc(u, v, arc); } return arc; @@ -1196,24 +1200,25 @@ Edge findEdge(const Node& u, const Node& v, const Edge& prev = INVALID) const { Edge edge = Parent::findEdge(u, v, prev); - while (edge != INVALID && !(*_edge_filter_map)[edge]) { + while (edge != INVALID && !(*_edge_filter)[edge]) { edge = Parent::findEdge(u, v, edge); } return edge; } - template - class NodeMap : public SubMapExtender > { + template + class NodeMap + : public SubMapExtender, + LEMON_SCOPE_FIX(GraphAdaptorBase, NodeMap)> { public: - typedef _Value Value; - typedef SubMapExtender > MapParent; - - NodeMap(const Adaptor& adaptor) - : MapParent(adaptor) {} - NodeMap(const Adaptor& adaptor, const Value& value) - : MapParent(adaptor, value) {} + typedef V Value; + typedef SubMapExtender, + LEMON_SCOPE_FIX(GraphAdaptorBase, NodeMap)> Parent; + + NodeMap(const SubGraphBase& adaptor) + : Parent(adaptor) {} + NodeMap(const SubGraphBase& adaptor, const V& value) + : Parent(adaptor, value) {} private: NodeMap& operator=(const NodeMap& cmap) { @@ -1222,23 +1227,24 @@ template NodeMap& operator=(const CMap& cmap) { - MapParent::operator=(cmap); + Parent::operator=(cmap); return *this; } }; - template - class ArcMap : public SubMapExtender > { + template + class ArcMap + : public SubMapExtender, + LEMON_SCOPE_FIX(GraphAdaptorBase, ArcMap)> { public: - typedef _Value Value; - typedef SubMapExtender > MapParent; - - ArcMap(const Adaptor& adaptor) - : MapParent(adaptor) {} - ArcMap(const Adaptor& adaptor, const Value& value) - : MapParent(adaptor, value) {} + typedef V Value; + typedef SubMapExtender, + LEMON_SCOPE_FIX(GraphAdaptorBase, ArcMap)> Parent; + + ArcMap(const SubGraphBase& adaptor) + : Parent(adaptor) {} + ArcMap(const SubGraphBase& adaptor, const V& value) + : Parent(adaptor, value) {} private: ArcMap& operator=(const ArcMap& cmap) { @@ -1247,24 +1253,25 @@ template ArcMap& operator=(const CMap& cmap) { - MapParent::operator=(cmap); + Parent::operator=(cmap); return *this; } }; - template - class EdgeMap : public SubMapExtender > { + template + class EdgeMap + : public SubMapExtender, + LEMON_SCOPE_FIX(GraphAdaptorBase, EdgeMap)> { public: - typedef _Value Value; - typedef SubMapExtender > MapParent; - - EdgeMap(const Adaptor& adaptor) - : MapParent(adaptor) {} - - EdgeMap(const Adaptor& adaptor, const _Value& value) - : MapParent(adaptor, value) {} + typedef V Value; + typedef SubMapExtender, + LEMON_SCOPE_FIX(GraphAdaptorBase, EdgeMap)> Parent; + + EdgeMap(const SubGraphBase& adaptor) + : Parent(adaptor) {} + + EdgeMap(const SubGraphBase& adaptor, const V& value) + : Parent(adaptor, value) {} private: EdgeMap& operator=(const EdgeMap& cmap) { @@ -1273,7 +1280,7 @@ template EdgeMap& operator=(const CMap& cmap) { - MapParent::operator=(cmap); + Parent::operator=(cmap); return *this; } }; @@ -1332,7 +1339,7 @@ /// The type of the edge filter map. typedef EF EdgeFilterMap; - typedef GraphAdaptorExtender< SubGraphBase > + typedef GraphAdaptorExtender > Parent; typedef typename Parent::Node Node; @@ -1346,11 +1353,8 @@ /// /// Creates a subgraph for the given graph with the given node /// and edge filter maps. - SubGraph(Graph& graph, NodeFilterMap& node_filter_map, - EdgeFilterMap& edge_filter_map) { - setGraph(graph); - setNodeFilterMap(node_filter_map); - setEdgeFilterMap(edge_filter_map); + SubGraph(GR& graph, NF& node_filter, EF& edge_filter) { + initialize(graph, node_filter, edge_filter); } /// \brief Sets the status of the given node @@ -1414,34 +1418,30 @@ /// \relates SubGraph template SubGraph - subGraph(const GR& graph, - NF& node_filter_map, EF& edge_filter_map) { + subGraph(const GR& graph, NF& node_filter, EF& edge_filter) { return SubGraph - (graph, node_filter_map, edge_filter_map); + (graph, node_filter, edge_filter); } template SubGraph - subGraph(const GR& graph, - const NF& node_filter_map, EF& edge_filter_map) { + subGraph(const GR& graph, const NF& node_filter, EF& edge_filter) { return SubGraph - (graph, node_filter_map, edge_filter_map); + (graph, node_filter, edge_filter); } template SubGraph - subGraph(const GR& graph, - NF& node_filter_map, const EF& edge_filter_map) { + subGraph(const GR& graph, NF& node_filter, const EF& edge_filter) { return SubGraph - (graph, node_filter_map, edge_filter_map); + (graph, node_filter, edge_filter); } template SubGraph - subGraph(const GR& graph, - const NF& node_filter_map, const EF& edge_filter_map) { + subGraph(const GR& graph, const NF& node_filter, const EF& edge_filter) { return SubGraph - (graph, node_filter_map, edge_filter_map); + (graph, node_filter, edge_filter); } @@ -1481,7 +1481,8 @@ typename Enable = void> class FilterNodes : public DigraphAdaptorExtender< - SubDigraphBase, true> > { + SubDigraphBase >, + true> > { #endif public: @@ -1489,17 +1490,15 @@ typedef NF NodeFilterMap; typedef DigraphAdaptorExtender< - SubDigraphBase, true> > - Parent; + SubDigraphBase >, + true> > Parent; typedef typename Parent::Node Node; protected: - ConstMap const_true_map; - - FilterNodes() : const_true_map(true) { - Parent::setArcFilterMap(const_true_map); - } + ConstMap > const_true_map; + + FilterNodes() : const_true_map() {} public: @@ -1507,12 +1506,10 @@ /// /// Creates a subgraph for the given digraph or graph with the /// given node filter map. - FilterNodes(GR& graph, NodeFilterMap& node_filter) : - Parent(), const_true_map(true) + FilterNodes(GR& graph, NF& node_filter) + : Parent(), const_true_map() { - Parent::setDigraph(graph); - Parent::setNodeFilterMap(node_filter); - Parent::setArcFilterMap(const_true_map); + Parent::initialize(graph, node_filter, const_true_map); } /// \brief Sets the status of the given node @@ -1547,30 +1544,27 @@ class FilterNodes >::type> : public GraphAdaptorExtender< - SubGraphBase, true> > { + SubGraphBase >, + true> > { public: typedef GR Graph; typedef NF NodeFilterMap; typedef GraphAdaptorExtender< - SubGraphBase, true> > - Parent; + SubGraphBase >, + true> > Parent; typedef typename Parent::Node Node; protected: - ConstMap const_true_map; - - FilterNodes() : const_true_map(true) { - Parent::setEdgeFilterMap(const_true_map); - } + ConstMap > const_true_map; + + FilterNodes() : const_true_map() {} public: - FilterNodes(Graph& _graph, NodeFilterMap& node_filter_map) : - Parent(), const_true_map(true) { - Parent::setGraph(_graph); - Parent::setNodeFilterMap(node_filter_map); - Parent::setEdgeFilterMap(const_true_map); + FilterNodes(GR& graph, NodeFilterMap& node_filter) : + Parent(), const_true_map() { + Parent::initialize(graph, node_filter, const_true_map); } void status(const Node& n, bool v) const { Parent::status(n, v); } @@ -1588,14 +1582,14 @@ /// \relates FilterNodes template FilterNodes - filterNodes(const GR& graph, NF& node_filter_map) { - return FilterNodes(graph, node_filter_map); + filterNodes(const GR& graph, NF& node_filter) { + return FilterNodes(graph, node_filter); } template FilterNodes - filterNodes(const GR& graph, const NF& node_filter_map) { - return FilterNodes(graph, node_filter_map); + filterNodes(const GR& graph, const NF& node_filter) { + return FilterNodes(graph, node_filter); } /// \ingroup graph_adaptors @@ -1612,45 +1606,44 @@ /// by adding or removing nodes or arcs, unless the \c GR template /// parameter is set to be \c const. /// - /// \tparam GR The type of the adapted digraph. + /// \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. /// \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". + /// \ref concepts::Digraph::ArcMap "DGR::ArcMap". /// /// \note The \c Node and \c Arc types of this adaptor and the adapted /// digraph are convertible to each other. #ifdef DOXYGEN - template class FilterArcs { #else - template > + template > class FilterArcs : public DigraphAdaptorExtender< - SubDigraphBase, AF, false> > { + SubDigraphBase >, + AF, false> > { #endif public: /// The type of the adapted digraph. - typedef GR Digraph; + typedef DGR Digraph; /// The type of the arc filter map. typedef AF ArcFilterMap; typedef DigraphAdaptorExtender< - SubDigraphBase, AF, false> > - Parent; + SubDigraphBase >, + AF, false> > Parent; typedef typename Parent::Arc Arc; protected: - ConstMap const_true_map; - - FilterArcs() : const_true_map(true) { - Parent::setNodeFilterMap(const_true_map); - } + ConstMap > const_true_map; + + FilterArcs() : const_true_map() {} public: @@ -1658,11 +1651,9 @@ /// /// Creates a subdigraph for the given digraph with the given arc /// filter map. - FilterArcs(Digraph& digraph, ArcFilterMap& arc_filter) - : Parent(), const_true_map(true) { - Parent::setDigraph(digraph); - Parent::setNodeFilterMap(const_true_map); - Parent::setArcFilterMap(arc_filter); + FilterArcs(DGR& digraph, ArcFilterMap& arc_filter) + : Parent(), const_true_map() { + Parent::initialize(digraph, const_true_map, arc_filter); } /// \brief Sets the status of the given arc @@ -1698,16 +1689,16 @@ /// This function just returns a read-only \ref FilterArcs adaptor. /// \ingroup graph_adaptors /// \relates FilterArcs - template - FilterArcs - filterArcs(const GR& digraph, AF& arc_filter_map) { - return FilterArcs(digraph, arc_filter_map); + template + FilterArcs + filterArcs(const DGR& digraph, AF& arc_filter) { + return FilterArcs(digraph, arc_filter); } - template - FilterArcs - filterArcs(const GR& digraph, const AF& arc_filter_map) { - return FilterArcs(digraph, arc_filter_map); + template + FilterArcs + filterArcs(const DGR& digraph, const AF& arc_filter) { + return FilterArcs(digraph, arc_filter); } /// \ingroup graph_adaptors @@ -1743,7 +1734,8 @@ typename EF = typename GR::template EdgeMap > class FilterEdges : public GraphAdaptorExtender< - SubGraphBase, EF, false> > { + SubGraphBase >, + EF, false> > { #endif public: /// The type of the adapted graph. @@ -1752,13 +1744,13 @@ typedef EF EdgeFilterMap; typedef GraphAdaptorExtender< - SubGraphBase, EF, false> > - Parent; + SubGraphBase >, + EF, false> > Parent; typedef typename Parent::Edge Edge; protected: - ConstMap const_true_map; + ConstMap > const_true_map; FilterEdges() : const_true_map(true) { Parent::setNodeFilterMap(const_true_map); @@ -1770,11 +1762,9 @@ /// /// Creates a subgraph for the given graph with the given edge /// filter map. - FilterEdges(Graph& graph, EdgeFilterMap& edge_filter_map) : - Parent(), const_true_map(true) { - Parent::setGraph(graph); - Parent::setNodeFilterMap(const_true_map); - Parent::setEdgeFilterMap(edge_filter_map); + FilterEdges(GR& graph, EF& edge_filter) + : Parent(), const_true_map() { + Parent::initialize(graph, const_true_map, edge_filter); } /// \brief Sets the status of the given edge @@ -1812,21 +1802,21 @@ /// \relates FilterEdges template FilterEdges - filterEdges(const GR& graph, EF& edge_filter_map) { - return FilterEdges(graph, edge_filter_map); + filterEdges(const GR& graph, EF& edge_filter) { + return FilterEdges(graph, edge_filter); } template FilterEdges - filterEdges(const GR& graph, const EF& edge_filter_map) { - return FilterEdges(graph, edge_filter_map); + filterEdges(const GR& graph, const EF& edge_filter) { + return FilterEdges(graph, edge_filter); } - template + template class UndirectorBase { public: - typedef _Digraph Digraph; + typedef DGR Digraph; typedef UndirectorBase Adaptor; typedef True UndirectedTag; @@ -2062,34 +2052,35 @@ private: - template + template class ArcMapBase { private: - typedef typename Digraph::template ArcMap<_Value> MapImpl; + typedef typename DGR::template ArcMap MapImpl; public: typedef typename MapTraits::ReferenceMapTag ReferenceMapTag; - typedef _Value Value; + typedef V Value; typedef Arc Key; typedef typename MapTraits::ConstReturnValue ConstReturnValue; typedef typename MapTraits::ReturnValue ReturnValue; typedef typename MapTraits::ConstReturnValue ConstReference; typedef typename MapTraits::ReturnValue Reference; - ArcMapBase(const Adaptor& adaptor) : + ArcMapBase(const UndirectorBase& adaptor) : _forward(*adaptor._digraph), _backward(*adaptor._digraph) {} - ArcMapBase(const Adaptor& adaptor, const Value& v) - : _forward(*adaptor._digraph, v), _backward(*adaptor._digraph, v) {} - - void set(const Arc& a, const Value& v) { + ArcMapBase(const UndirectorBase& adaptor, const V& value) + : _forward(*adaptor._digraph, value), + _backward(*adaptor._digraph, value) {} + + void set(const Arc& a, const V& value) { if (direction(a)) { - _forward.set(a, v); + _forward.set(a, value); } else { - _backward.set(a, v); + _backward.set(a, value); } } @@ -2117,17 +2108,17 @@ public: - template - class NodeMap : public Digraph::template NodeMap<_Value> { + template + class NodeMap : public DGR::template NodeMap { public: - typedef _Value Value; - typedef typename Digraph::template NodeMap Parent; - - explicit NodeMap(const Adaptor& adaptor) + typedef V Value; + typedef typename DGR::template NodeMap Parent; + + explicit NodeMap(const UndirectorBase& adaptor) : Parent(*adaptor._digraph) {} - NodeMap(const Adaptor& adaptor, const _Value& value) + NodeMap(const UndirectorBase& adaptor, const V& value) : Parent(*adaptor._digraph, value) { } private: @@ -2143,18 +2134,18 @@ }; - template + template class ArcMap - : public SubMapExtender > + : public SubMapExtender, ArcMapBase > { public: - typedef _Value Value; - typedef SubMapExtender > Parent; - - explicit ArcMap(const Adaptor& adaptor) + typedef V Value; + typedef SubMapExtender > Parent; + + explicit ArcMap(const UndirectorBase& adaptor) : Parent(adaptor) {} - ArcMap(const Adaptor& adaptor, const Value& value) + ArcMap(const UndirectorBase& adaptor, const V& value) : Parent(adaptor, value) {} private: @@ -2169,17 +2160,17 @@ } }; - template - class EdgeMap : public Digraph::template ArcMap<_Value> { + template + class EdgeMap : public Digraph::template ArcMap { public: - typedef _Value Value; - typedef typename Digraph::template ArcMap Parent; - - explicit EdgeMap(const Adaptor& adaptor) + typedef V Value; + typedef typename Digraph::template ArcMap Parent; + + explicit EdgeMap(const UndirectorBase& adaptor) : Parent(*adaptor._digraph) {} - EdgeMap(const Adaptor& adaptor, const Value& value) + EdgeMap(const UndirectorBase& adaptor, const V& value) : Parent(*adaptor._digraph, value) {} private: @@ -2195,19 +2186,19 @@ }; - typedef typename ItemSetTraits::ItemNotifier NodeNotifier; + typedef typename ItemSetTraits::ItemNotifier NodeNotifier; NodeNotifier& notifier(Node) const { return _digraph->notifier(Node()); } - typedef typename ItemSetTraits::ItemNotifier EdgeNotifier; + typedef typename ItemSetTraits::ItemNotifier EdgeNotifier; EdgeNotifier& notifier(Edge) const { return _digraph->notifier(Edge()); } protected: UndirectorBase() : _digraph(0) {} - Digraph* _digraph; - - void setDigraph(Digraph& digraph) { + DGR* _digraph; + + void initialize(DGR& digraph) { _digraph = &digraph; } @@ -2226,7 +2217,7 @@ /// by adding or removing nodes or edges, unless the \c GR template /// parameter is set to be \c const. /// - /// \tparam GR The type of the adapted digraph. + /// \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. /// @@ -2236,17 +2227,17 @@ /// each other. /// (Thus the \c Arc type of the adaptor is convertible to the \c Arc type /// of the adapted digraph.) - template + template #ifdef DOXYGEN class Undirector { #else class Undirector : - public GraphAdaptorExtender > { + public GraphAdaptorExtender > { #endif public: /// The type of the adapted digraph. - typedef GR Digraph; - typedef GraphAdaptorExtender > Parent; + typedef DGR Digraph; + typedef GraphAdaptorExtender > Parent; protected: Undirector() { } public: @@ -2254,8 +2245,8 @@ /// \brief Constructor /// /// Creates an undirected graph from the given digraph. - Undirector(Digraph& digraph) { - setDigraph(digraph); + Undirector(DGR& digraph) { + initialize(digraph); } /// \brief Arc map combined from two original arc maps @@ -2355,21 +2346,21 @@ /// This function just returns a read-only \ref Undirector adaptor. /// \ingroup graph_adaptors /// \relates Undirector - template - Undirector undirector(const GR& digraph) { - return Undirector(digraph); + template + Undirector undirector(const DGR& digraph) { + return Undirector(digraph); } - template + template class OrienterBase { public: - typedef _Graph Graph; - typedef _DirectionMap DirectionMap; - - typedef typename Graph::Node Node; - typedef typename Graph::Edge Arc; + typedef GR Graph; + typedef DM DirectionMap; + + typedef typename GR::Node Node; + typedef typename GR::Edge Arc; void reverseArc(const Arc& arc) { _direction->set(arc, !(*_direction)[arc]); @@ -2448,22 +2439,22 @@ int maxNodeId() const { return _graph->maxNodeId(); } int maxArcId() const { return _graph->maxEdgeId(); } - typedef typename ItemSetTraits::ItemNotifier NodeNotifier; + typedef typename ItemSetTraits::ItemNotifier NodeNotifier; NodeNotifier& notifier(Node) const { return _graph->notifier(Node()); } - typedef typename ItemSetTraits::ItemNotifier ArcNotifier; + typedef typename ItemSetTraits::ItemNotifier ArcNotifier; ArcNotifier& notifier(Arc) const { return _graph->notifier(Arc()); } - template - class NodeMap : public _Graph::template NodeMap<_Value> { + template + class NodeMap : public GR::template NodeMap { public: - typedef typename _Graph::template NodeMap<_Value> Parent; - - explicit NodeMap(const OrienterBase& adapter) + typedef typename GR::template NodeMap Parent; + + explicit NodeMap(const OrienterBase& adapter) : Parent(*adapter._graph) {} - NodeMap(const OrienterBase& adapter, const _Value& value) + NodeMap(const OrienterBase& adapter, const V& value) : Parent(*adapter._graph, value) {} private: @@ -2479,16 +2470,16 @@ }; - template - class ArcMap : public _Graph::template EdgeMap<_Value> { + template + class ArcMap : public GR::template EdgeMap { public: - typedef typename Graph::template EdgeMap<_Value> Parent; - - explicit ArcMap(const OrienterBase& adapter) + typedef typename Graph::template EdgeMap Parent; + + explicit ArcMap(const OrienterBase& adapter) : Parent(*adapter._graph) { } - ArcMap(const OrienterBase& adapter, const _Value& value) + ArcMap(const OrienterBase& adapter, const V& value) : Parent(*adapter._graph, value) { } private: @@ -2507,16 +2498,13 @@ protected: Graph* _graph; - DirectionMap* _direction; - - void setDirectionMap(DirectionMap& direction) { + DM* _direction; + + void initialize(GR& graph, DM& direction) { + _graph = &graph; _direction = &direction; } - void setGraph(Graph& graph) { - _graph = &graph; - } - }; /// \ingroup graph_adaptors @@ -2572,9 +2560,8 @@ /// \brief Constructor /// /// Constructor of the adaptor. - Orienter(Graph& graph, DirectionMap& direction) { - setGraph(graph); - setDirectionMap(direction); + Orienter(GR& graph, DM& direction) { + Parent::initialize(graph, direction); } /// \brief Reverses the given arc @@ -2594,67 +2581,62 @@ /// \relates Orienter template Orienter - orienter(const GR& graph, DM& direction_map) { - return Orienter(graph, direction_map); + orienter(const GR& graph, DM& direction) { + return Orienter(graph, direction); } template Orienter - orienter(const GR& graph, const DM& direction_map) { - return Orienter(graph, direction_map); + orienter(const GR& graph, const DM& direction) { + return Orienter(graph, direction); } namespace _adaptor_bits { - template + template class ResForwardFilter { public: - typedef typename Digraph::Arc Key; + typedef typename DGR::Arc Key; typedef bool Value; private: - const CapacityMap* _capacity; - const FlowMap* _flow; - Tolerance _tolerance; + const CM* _capacity; + const FM* _flow; + TL _tolerance; + public: - ResForwardFilter(const CapacityMap& capacity, const FlowMap& flow, - const Tolerance& tolerance = Tolerance()) + ResForwardFilter(const CM& capacity, const FM& flow, + const TL& tolerance = TL()) : _capacity(&capacity), _flow(&flow), _tolerance(tolerance) { } - bool operator[](const typename Digraph::Arc& a) const { + bool operator[](const typename DGR::Arc& a) const { return _tolerance.positive((*_capacity)[a] - (*_flow)[a]); } }; - template + template class ResBackwardFilter { public: - typedef typename Digraph::Arc Key; + typedef typename DGR::Arc Key; typedef bool Value; private: - const CapacityMap* _capacity; - const FlowMap* _flow; - Tolerance _tolerance; + const CM* _capacity; + const FM* _flow; + TL _tolerance; public: - ResBackwardFilter(const CapacityMap& capacity, const FlowMap& flow, - const Tolerance& tolerance = Tolerance()) + ResBackwardFilter(const CM& capacity, const FM& flow, + const TL& tolerance = TL()) : _capacity(&capacity), _flow(&flow), _tolerance(tolerance) { } - bool operator[](const typename Digraph::Arc& a) const { + bool operator[](const typename DGR::Arc& a) const { return _tolerance.positive((*_flow)[a]); } }; @@ -2681,7 +2663,7 @@ /// arcs). /// This class conforms to the \ref concepts::Digraph "Digraph" concept. /// - /// \tparam GR The type of the adapted digraph. + /// \tparam DGR The type of the adapted digraph. /// It must conform to the \ref concepts::Digraph "Digraph" concept. /// It is implicitly \c const. /// \tparam CM The type of the capacity map. @@ -2703,25 +2685,26 @@ /// 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 ResidualDigraph #else - template, + template, typename FM = CM, typename TL = Tolerance > - class ResidualDigraph : - public FilterArcs< - Undirector, - typename Undirector::template CombinedArcMap< - _adaptor_bits::ResForwardFilter, - _adaptor_bits::ResBackwardFilter > > + class ResidualDigraph + : public SubDigraph< + Undirector, + ConstMap >, + typename Undirector::template CombinedArcMap< + _adaptor_bits::ResForwardFilter, + _adaptor_bits::ResBackwardFilter > > #endif { public: /// The type of the underlying digraph. - typedef GR Digraph; + typedef DGR Digraph; /// The type of the capacity map. typedef CM CapacityMap; /// The type of the flow map. @@ -2736,21 +2719,24 @@ typedef Undirector Undirected; - typedef _adaptor_bits::ResForwardFilter ForwardFilter; - - typedef _adaptor_bits::ResBackwardFilter BackwardFilter; + typedef ConstMap > NodeFilter; + + typedef _adaptor_bits::ResForwardFilter ForwardFilter; + + typedef _adaptor_bits::ResBackwardFilter BackwardFilter; typedef typename Undirected:: template CombinedArcMap ArcFilter; - typedef FilterArcs Parent; + typedef SubDigraph Parent; const CapacityMap* _capacity; FlowMap* _flow; Undirected _graph; + NodeFilter _node_filter; ForwardFilter _forward_filter; BackwardFilter _backward_filter; ArcFilter _arc_filter; @@ -2761,15 +2747,15 @@ /// /// Constructor of the residual digraph adaptor. The parameters are the /// digraph, the capacity map, the flow map, and a tolerance object. - ResidualDigraph(const Digraph& digraph, const CapacityMap& capacity, - FlowMap& flow, const Tolerance& tolerance = Tolerance()) - : Parent(), _capacity(&capacity), _flow(&flow), _graph(digraph), + ResidualDigraph(const DGR& digraph, const CM& capacity, + FM& flow, const TL& tolerance = Tolerance()) + : Parent(), _capacity(&capacity), _flow(&flow), + _graph(digraph), _node_filter(), _forward_filter(capacity, flow, tolerance), _backward_filter(capacity, flow, tolerance), _arc_filter(_forward_filter, _backward_filter) { - Parent::setDigraph(_graph); - Parent::setArcFilterMap(_arc_filter); + Parent::initialize(_graph, _node_filter, _arc_filter); } typedef typename Parent::Arc Arc; @@ -2845,7 +2831,8 @@ typedef typename CapacityMap::Value Value; /// Constructor - ResidualCapacity(const Adaptor& adaptor) : _adaptor(&adaptor) {} + ResidualCapacity(const ResidualDigraph& adaptor) + : _adaptor(&adaptor) {} /// Returns the value associated with the given residual arc Value operator[](const Arc& a) const { @@ -2865,26 +2852,26 @@ /// \brief Returns a (read-only) Residual adaptor /// - /// This function just returns a (read-only) \ref Residual adaptor. + /// This function just returns a (read-only) \ref ResidualDigraph adaptor. /// \ingroup graph_adaptors - /// \relates Residual - template - ResidualDigraph - residualDigraph(const GR& digraph, const CM& capacity_map, FM& flow_map) { - return ResidualDigraph (digraph, capacity_map, flow_map); + /// \relates ResidualDigraph + template + ResidualDigraph + residualDigraph(const DGR& digraph, const CM& capacity_map, FM& flow_map) { + return ResidualDigraph (digraph, capacity_map, flow_map); } - template + template class SplitNodesBase { public: - typedef _Digraph Digraph; - typedef DigraphAdaptorBase Parent; + typedef DGR Digraph; + typedef DigraphAdaptorBase Parent; typedef SplitNodesBase Adaptor; - typedef typename Digraph::Node DigraphNode; - typedef typename Digraph::Arc DigraphArc; + typedef typename DGR::Node DigraphNode; + typedef typename DGR::Arc DigraphArc; class Node; class Arc; @@ -3148,32 +3135,32 @@ private: - template + template class NodeMapBase - : public MapTraits > { - typedef typename Parent::template NodeMap<_Value> NodeImpl; + : public MapTraits > { + typedef typename Parent::template NodeMap NodeImpl; public: typedef Node Key; - typedef _Value Value; + typedef V 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; - NodeMapBase(const Adaptor& adaptor) + NodeMapBase(const SplitNodesBase& adaptor) : _in_map(*adaptor._digraph), _out_map(*adaptor._digraph) {} - NodeMapBase(const Adaptor& adaptor, const Value& value) + NodeMapBase(const SplitNodesBase& adaptor, const V& value) : _in_map(*adaptor._digraph, value), _out_map(*adaptor._digraph, value) {} - void set(const Node& key, const Value& val) { - if (Adaptor::inNode(key)) { _in_map.set(key, val); } + void set(const Node& key, const V& val) { + if (SplitNodesBase::inNode(key)) { _in_map.set(key, val); } else {_out_map.set(key, val); } } ReturnValue operator[](const Node& key) { - if (Adaptor::inNode(key)) { return _in_map[key]; } + if (SplitNodesBase::inNode(key)) { return _in_map[key]; } else { return _out_map[key]; } } @@ -3186,28 +3173,28 @@ NodeImpl _in_map, _out_map; }; - template + template class ArcMapBase - : public MapTraits > { - typedef typename Parent::template ArcMap<_Value> ArcImpl; - typedef typename Parent::template NodeMap<_Value> NodeImpl; + : public MapTraits > { + typedef typename Parent::template ArcMap ArcImpl; + typedef typename Parent::template NodeMap NodeImpl; public: typedef Arc Key; - typedef _Value Value; + typedef V 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; - ArcMapBase(const Adaptor& adaptor) + ArcMapBase(const SplitNodesBase& adaptor) : _arc_map(*adaptor._digraph), _node_map(*adaptor._digraph) {} - ArcMapBase(const Adaptor& adaptor, const Value& value) + ArcMapBase(const SplitNodesBase& adaptor, const V& value) : _arc_map(*adaptor._digraph, value), _node_map(*adaptor._digraph, value) {} - void set(const Arc& key, const Value& val) { - if (Adaptor::origArc(key)) { + void set(const Arc& key, const V& val) { + if (SplitNodesBase::origArc(key)) { _arc_map.set(key._item.first(), val); } else { _node_map.set(key._item.second(), val); @@ -3215,7 +3202,7 @@ } ReturnValue operator[](const Arc& key) { - if (Adaptor::origArc(key)) { + if (SplitNodesBase::origArc(key)) { return _arc_map[key._item.first()]; } else { return _node_map[key._item.second()]; @@ -3223,7 +3210,7 @@ } ConstReturnValue operator[](const Arc& key) const { - if (Adaptor::origArc(key)) { + if (SplitNodesBase::origArc(key)) { return _arc_map[key._item.first()]; } else { return _node_map[key._item.second()]; @@ -3237,18 +3224,18 @@ public: - template + template class NodeMap - : public SubMapExtender > + : public SubMapExtender, NodeMapBase > { public: - typedef _Value Value; - typedef SubMapExtender > Parent; - - NodeMap(const Adaptor& adaptor) + typedef V Value; + typedef SubMapExtender, NodeMapBase > Parent; + + NodeMap(const SplitNodesBase& adaptor) : Parent(adaptor) {} - NodeMap(const Adaptor& adaptor, const Value& value) + NodeMap(const SplitNodesBase& adaptor, const V& value) : Parent(adaptor, value) {} private: @@ -3263,18 +3250,18 @@ } }; - template + template class ArcMap - : public SubMapExtender > + : public SubMapExtender, ArcMapBase > { public: - typedef _Value Value; - typedef SubMapExtender > Parent; - - ArcMap(const Adaptor& adaptor) + typedef V Value; + typedef SubMapExtender, ArcMapBase > Parent; + + ArcMap(const SplitNodesBase& adaptor) : Parent(adaptor) {} - ArcMap(const Adaptor& adaptor, const Value& value) + ArcMap(const SplitNodesBase& adaptor, const V& value) : Parent(adaptor, value) {} private: @@ -3293,9 +3280,9 @@ SplitNodesBase() : _digraph(0) {} - Digraph* _digraph; - - void setDigraph(Digraph& digraph) { + DGR* _digraph; + + void initialize(Digraph& digraph) { _digraph = &digraph; } @@ -3322,25 +3309,25 @@ /// costs/capacities of the original digraph to the \e bind \e arcs /// in the adaptor. /// - /// \tparam GR The type of the adapted digraph. + /// \tparam DGR 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 GR Digraph; - typedef DigraphAdaptorExtender > Parent; - - typedef typename Digraph::Node DigraphNode; - typedef typename Digraph::Arc DigraphArc; + typedef DGR Digraph; + typedef DigraphAdaptorExtender > Parent; + + typedef typename DGR::Node DigraphNode; + typedef typename DGR::Arc DigraphArc; typedef typename Parent::Node Node; typedef typename Parent::Arc Arc; @@ -3348,8 +3335,8 @@ /// \brief Constructor /// /// Constructor of the adaptor. - SplitNodes(const Digraph& g) { - Parent::setDigraph(g); + SplitNodes(const DGR& g) { + Parent::initialize(g); } /// \brief Returns \c true if the given node is an in-node. @@ -3441,7 +3428,7 @@ /// Returns the value associated with the given key. Value operator[](const Key& key) const { - if (Parent::inNode(key)) { + if (SplitNodesBase::inNode(key)) { return _in_map[key]; } else { return _out_map[key]; @@ -3450,7 +3437,7 @@ /// Returns a reference to the value associated with the given key. Value& operator[](const Key& key) { - if (Parent::inNode(key)) { + if (SplitNodesBase::inNode(key)) { return _in_map[key]; } else { return _out_map[key]; @@ -3459,7 +3446,7 @@ /// Sets the value associated with the given key. void set(const Key& key, const Value& value) { - if (Parent::inNode(key)) { + if (SplitNodesBase::inNode(key)) { _in_map.set(key, value); } else { _out_map.set(key, value); @@ -3530,7 +3517,7 @@ /// Returns the value associated with the given key. Value operator[](const Key& arc) const { - if (Parent::origArc(arc)) { + if (SplitNodesBase::origArc(arc)) { return _arc_map[arc]; } else { return _node_map[arc]; @@ -3539,7 +3526,7 @@ /// Returns a reference to the value associated with the given key. Value& operator[](const Key& arc) { - if (Parent::origArc(arc)) { + if (SplitNodesBase::origArc(arc)) { return _arc_map[arc]; } else { return _node_map[arc]; @@ -3548,7 +3535,7 @@ /// Sets the value associated with the given key. void set(const Arc& arc, const Value& val) { - if (Parent::origArc(arc)) { + if (SplitNodesBase::origArc(arc)) { _arc_map.set(arc, val); } else { _node_map.set(arc, val); @@ -3594,12 +3581,14 @@ /// This function just returns a (read-only) \ref SplitNodes adaptor. /// \ingroup graph_adaptors /// \relates SplitNodes - template - SplitNodes - splitNodes(const GR& digraph) { - return SplitNodes(digraph); + template + SplitNodes + splitNodes(const DGR& digraph) { + return SplitNodes(digraph); } +#undef LEMON_SCOPE_FIX + } //namespace lemon #endif //LEMON_ADAPTORS_H diff -r 861a9d5ff283 -r 9b9ffe7d9b75 lemon/edge_set.h --- a/lemon/edge_set.h Fri Jan 23 16:42:07 2009 +0000 +++ b/lemon/edge_set.h Fri Feb 13 13:29:28 2009 +0100 @@ -29,13 +29,13 @@ /// Graphs which use another graph's node-set as own. namespace lemon { - template + template class ListArcSetBase { public: - typedef _Graph Graph; - typedef typename Graph::Node Node; - typedef typename Graph::NodeIt NodeIt; + typedef GR Graph; + typedef typename GR::Node Node; + typedef typename GR::NodeIt NodeIt; protected: @@ -44,10 +44,10 @@ NodeT() : first_out(-1), first_in(-1) {} }; - typedef typename ItemSetTraits:: + typedef typename ItemSetTraits:: template Map::Type NodesImplBase; - NodesImplBase* nodes; + NodesImplBase* _nodes; struct ArcT { Node source, target; @@ -61,17 +61,17 @@ int first_arc; int first_free_arc; - const Graph* graph; + const GR* _graph; - void initalize(const Graph& _graph, NodesImplBase& _nodes) { - graph = &_graph; - nodes = &_nodes; + void initalize(const GR& graph, NodesImplBase& nodes) { + _graph = &graph; + _nodes = &nodes; } public: class Arc { - friend class ListArcSetBase; + friend class ListArcSetBase; protected: Arc(int _id) : id(_id) {} int id; @@ -94,16 +94,16 @@ n = first_free_arc; first_free_arc = arcs[first_free_arc].next_in; } - arcs[n].next_in = (*nodes)[v].first_in; - if ((*nodes)[v].first_in != -1) { - arcs[(*nodes)[v].first_in].prev_in = n; + arcs[n].next_in = (*_nodes)[v].first_in; + if ((*_nodes)[v].first_in != -1) { + arcs[(*_nodes)[v].first_in].prev_in = n; } - (*nodes)[v].first_in = n; - arcs[n].next_out = (*nodes)[u].first_out; - if ((*nodes)[u].first_out != -1) { - arcs[(*nodes)[u].first_out].prev_out = n; + (*_nodes)[v].first_in = n; + arcs[n].next_out = (*_nodes)[u].first_out; + if ((*_nodes)[u].first_out != -1) { + arcs[(*_nodes)[u].first_out].prev_out = n; } - (*nodes)[u].first_out = n; + (*_nodes)[u].first_out = n; arcs[n].source = u; arcs[n].target = v; return Arc(n); @@ -114,7 +114,7 @@ if (arcs[n].prev_in != -1) { arcs[arcs[n].prev_in].next_in = arcs[n].next_in; } else { - (*nodes)[arcs[n].target].first_in = arcs[n].next_in; + (*_nodes)[arcs[n].target].first_in = arcs[n].next_in; } if (arcs[n].next_in != -1) { arcs[arcs[n].next_in].prev_in = arcs[n].prev_in; @@ -123,7 +123,7 @@ if (arcs[n].prev_out != -1) { arcs[arcs[n].prev_out].next_out = arcs[n].next_out; } else { - (*nodes)[arcs[n].source].first_out = arcs[n].next_out; + (*_nodes)[arcs[n].source].first_out = arcs[n].next_out; } if (arcs[n].next_out != -1) { arcs[arcs[n].next_out].prev_out = arcs[n].prev_out; @@ -134,8 +134,8 @@ void clear() { Node node; for (first(node); node != INVALID; next(node)) { - (*nodes)[node].first_in = -1; - (*nodes)[node].first_out = -1; + (*_nodes)[node].first_in = -1; + (*_nodes)[node].first_out = -1; } arcs.clear(); first_arc = -1; @@ -143,20 +143,20 @@ } void first(Node& node) const { - graph->first(node); + _graph->first(node); } void next(Node& node) const { - graph->next(node); + _graph->next(node); } void first(Arc& arc) const { Node node; first(node); - while (node != INVALID && (*nodes)[node].first_in == -1) { + while (node != INVALID && (*_nodes)[node].first_in == -1) { next(node); } - arc.id = (node == INVALID) ? -1 : (*nodes)[node].first_in; + arc.id = (node == INVALID) ? -1 : (*_nodes)[node].first_in; } void next(Arc& arc) const { @@ -165,15 +165,15 @@ } else { Node node = arcs[arc.id].target; next(node); - while (node != INVALID && (*nodes)[node].first_in == -1) { + while (node != INVALID && (*_nodes)[node].first_in == -1) { next(node); } - arc.id = (node == INVALID) ? -1 : (*nodes)[node].first_in; + arc.id = (node == INVALID) ? -1 : (*_nodes)[node].first_in; } } void firstOut(Arc& arc, const Node& node) const { - arc.id = (*nodes)[node].first_out; + arc.id = (*_nodes)[node].first_out; } void nextOut(Arc& arc) const { @@ -181,42 +181,42 @@ } void firstIn(Arc& arc, const Node& node) const { - arc.id = (*nodes)[node].first_in; + arc.id = (*_nodes)[node].first_in; } void nextIn(Arc& arc) const { arc.id = arcs[arc.id].next_in; } - int id(const Node& node) const { return graph->id(node); } + int id(const Node& node) const { return _graph->id(node); } int id(const Arc& arc) const { return arc.id; } - Node nodeFromId(int ix) const { return graph->nodeFromId(ix); } + Node nodeFromId(int ix) const { return _graph->nodeFromId(ix); } Arc arcFromId(int ix) const { return Arc(ix); } - int maxNodeId() const { return graph->maxNodeId(); }; + int maxNodeId() const { return _graph->maxNodeId(); }; int maxArcId() const { return arcs.size() - 1; } Node source(const Arc& arc) const { return arcs[arc.id].source;} Node target(const Arc& arc) const { return arcs[arc.id].target;} - typedef typename ItemSetTraits::ItemNotifier NodeNotifier; + typedef typename ItemSetTraits::ItemNotifier NodeNotifier; NodeNotifier& notifier(Node) const { - return graph->notifier(Node()); + return _graph->notifier(Node()); } - template - class NodeMap : public Graph::template NodeMap<_Value> { + template + class NodeMap : public GR::template NodeMap { public: - typedef typename _Graph::template NodeMap<_Value> Parent; + typedef typename GR::template NodeMap Parent; - explicit NodeMap(const ListArcSetBase& arcset) - : Parent(*arcset.graph) {} + explicit NodeMap(const ListArcSetBase& arcset) + : Parent(*arcset._graph) {} - NodeMap(const ListArcSetBase& arcset, const _Value& value) - : Parent(*arcset.graph, value) {} + NodeMap(const ListArcSetBase& arcset, const V& value) + : Parent(*arcset._graph, value) {} NodeMap& operator=(const NodeMap& cmap) { return operator=(cmap); @@ -250,24 +250,24 @@ /// that node can be removed from the underlying graph, in this case /// all arcs incident to the given node is erased from the arc set. /// - /// \param _Graph The type of the graph which shares its node set with + /// \param GR The type of the graph which shares its node set with /// this class. Its interface must conform to the /// \ref concepts::Digraph "Digraph" or \ref concepts::Graph "Graph" /// concept. /// /// This class is fully conform to the \ref concepts::Digraph /// "Digraph" concept. - template - class ListArcSet : public ArcSetExtender > { + template + class ListArcSet : public ArcSetExtender > { public: - typedef ArcSetExtender > Parent; + typedef ArcSetExtender > Parent; typedef typename Parent::Node Node; typedef typename Parent::Arc Arc; - typedef _Graph Graph; + typedef GR Graph; typedef typename Parent::NodesImplBase NodesImplBase; @@ -295,7 +295,7 @@ public: typedef NodesImplBase Parent; - NodesImpl(const Graph& graph, ListArcSet& arcset) + NodesImpl(const GR& graph, ListArcSet& arcset) : Parent(graph), _arcset(arcset) {} virtual ~NodesImpl() {} @@ -321,15 +321,15 @@ ListArcSet& _arcset; }; - NodesImpl nodes; + NodesImpl _nodes; public: /// \brief Constructor of the ArcSet. /// /// Constructor of the ArcSet. - ListArcSet(const Graph& graph) : nodes(graph, *this) { - Parent::initalize(graph, nodes); + ListArcSet(const GR& graph) : _nodes(graph, *this) { + Parent::initalize(graph, _nodes); } /// \brief Add a new arc to the digraph. @@ -350,13 +350,13 @@ }; - template + template class ListEdgeSetBase { public: - typedef _Graph Graph; - typedef typename Graph::Node Node; - typedef typename Graph::NodeIt NodeIt; + typedef GR Graph; + typedef typename GR::Node Node; + typedef typename GR::NodeIt NodeIt; protected: @@ -365,10 +365,10 @@ NodeT() : first_out(-1) {} }; - typedef typename ItemSetTraits:: + typedef typename ItemSetTraits:: template Map::Type NodesImplBase; - NodesImplBase* nodes; + NodesImplBase* _nodes; struct ArcT { Node target; @@ -381,11 +381,11 @@ int first_arc; int first_free_arc; - const Graph* graph; + const GR* _graph; - void initalize(const Graph& _graph, NodesImplBase& _nodes) { - graph = &_graph; - nodes = &_nodes; + void initalize(const GR& graph, NodesImplBase& nodes) { + _graph = &graph; + _nodes = &nodes; } public: @@ -437,18 +437,18 @@ arcs[n].target = u; arcs[n | 1].target = v; - arcs[n].next_out = (*nodes)[v].first_out; - if ((*nodes)[v].first_out != -1) { - arcs[(*nodes)[v].first_out].prev_out = n; + arcs[n].next_out = (*_nodes)[v].first_out; + if ((*_nodes)[v].first_out != -1) { + arcs[(*_nodes)[v].first_out].prev_out = n; } - (*nodes)[v].first_out = n; + (*_nodes)[v].first_out = n; arcs[n].prev_out = -1; - if ((*nodes)[u].first_out != -1) { - arcs[(*nodes)[u].first_out].prev_out = (n | 1); + if ((*_nodes)[u].first_out != -1) { + arcs[(*_nodes)[u].first_out].prev_out = (n | 1); } - arcs[n | 1].next_out = (*nodes)[u].first_out; - (*nodes)[u].first_out = (n | 1); + arcs[n | 1].next_out = (*_nodes)[u].first_out; + (*_nodes)[u].first_out = (n | 1); arcs[n | 1].prev_out = -1; return Edge(n / 2); @@ -464,7 +464,7 @@ if (arcs[n].prev_out != -1) { arcs[arcs[n].prev_out].next_out = arcs[n].next_out; } else { - (*nodes)[arcs[n | 1].target].first_out = arcs[n].next_out; + (*_nodes)[arcs[n | 1].target].first_out = arcs[n].next_out; } if (arcs[n | 1].next_out != -1) { @@ -474,7 +474,7 @@ if (arcs[n | 1].prev_out != -1) { arcs[arcs[n | 1].prev_out].next_out = arcs[n | 1].next_out; } else { - (*nodes)[arcs[n].target].first_out = arcs[n | 1].next_out; + (*_nodes)[arcs[n].target].first_out = arcs[n | 1].next_out; } arcs[n].next_out = first_free_arc; @@ -485,7 +485,7 @@ void clear() { Node node; for (first(node); node != INVALID; next(node)) { - (*nodes)[node].first_out = -1; + (*_nodes)[node].first_out = -1; } arcs.clear(); first_arc = -1; @@ -493,20 +493,20 @@ } void first(Node& node) const { - graph->first(node); + _graph->first(node); } void next(Node& node) const { - graph->next(node); + _graph->next(node); } void first(Arc& arc) const { Node node; first(node); - while (node != INVALID && (*nodes)[node].first_out == -1) { + while (node != INVALID && (*_nodes)[node].first_out == -1) { next(node); } - arc.id = (node == INVALID) ? -1 : (*nodes)[node].first_out; + arc.id = (node == INVALID) ? -1 : (*_nodes)[node].first_out; } void next(Arc& arc) const { @@ -515,10 +515,10 @@ } else { Node node = arcs[arc.id ^ 1].target; next(node); - while(node != INVALID && (*nodes)[node].first_out == -1) { + while(node != INVALID && (*_nodes)[node].first_out == -1) { next(node); } - arc.id = (node == INVALID) ? -1 : (*nodes)[node].first_out; + arc.id = (node == INVALID) ? -1 : (*_nodes)[node].first_out; } } @@ -526,7 +526,7 @@ Node node; first(node); while (node != INVALID) { - edge.id = (*nodes)[node].first_out; + edge.id = (*_nodes)[node].first_out; while ((edge.id & 1) != 1) { edge.id = arcs[edge.id].next_out; } @@ -551,7 +551,7 @@ } next(node); while (node != INVALID) { - edge.id = (*nodes)[node].first_out; + edge.id = (*_nodes)[node].first_out; while ((edge.id & 1) != 1) { edge.id = arcs[edge.id].next_out; } @@ -565,7 +565,7 @@ } void firstOut(Arc& arc, const Node& node) const { - arc.id = (*nodes)[node].first_out; + arc.id = (*_nodes)[node].first_out; } void nextOut(Arc& arc) const { @@ -573,7 +573,7 @@ } void firstIn(Arc& arc, const Node& node) const { - arc.id = (((*nodes)[node].first_out) ^ 1); + arc.id = (((*_nodes)[node].first_out) ^ 1); if (arc.id == -2) arc.id = -1; } @@ -583,7 +583,7 @@ } void firstInc(Edge &arc, bool& dir, const Node& node) const { - int de = (*nodes)[node].first_out; + int de = (*_nodes)[node].first_out; if (de != -1 ) { arc.id = de / 2; dir = ((de & 1) == 1); @@ -611,15 +611,15 @@ return Arc(edge.id * 2 + (dir ? 1 : 0)); } - int id(const Node& node) const { return graph->id(node); } + int id(const Node& node) const { return _graph->id(node); } static int id(Arc e) { return e.id; } static int id(Edge e) { return e.id; } - Node nodeFromId(int id) const { return graph->nodeFromId(id); } + Node nodeFromId(int id) const { return _graph->nodeFromId(id); } static Arc arcFromId(int id) { return Arc(id);} static Edge edgeFromId(int id) { return Edge(id);} - int maxNodeId() const { return graph->maxNodeId(); }; + int maxNodeId() const { return _graph->maxNodeId(); }; int maxEdgeId() const { return arcs.size() / 2 - 1; } int maxArcId() const { return arcs.size()-1; } @@ -629,23 +629,23 @@ Node u(Edge e) const { return arcs[2 * e.id].target; } Node v(Edge e) const { return arcs[2 * e.id + 1].target; } - typedef typename ItemSetTraits::ItemNotifier NodeNotifier; + typedef typename ItemSetTraits::ItemNotifier NodeNotifier; NodeNotifier& notifier(Node) const { - return graph->notifier(Node()); + return _graph->notifier(Node()); } - template - class NodeMap : public Graph::template NodeMap<_Value> { + template + class NodeMap : public GR::template NodeMap { public: - typedef typename _Graph::template NodeMap<_Value> Parent; + typedef typename GR::template NodeMap Parent; - explicit NodeMap(const ListEdgeSetBase& arcset) - : Parent(*arcset.graph) {} + explicit NodeMap(const ListEdgeSetBase& arcset) + : Parent(*arcset._graph) {} - NodeMap(const ListEdgeSetBase& arcset, const _Value& value) - : Parent(*arcset.graph, value) {} + NodeMap(const ListEdgeSetBase& arcset, const V& value) + : Parent(*arcset._graph, value) {} NodeMap& operator=(const NodeMap& cmap) { return operator=(cmap); @@ -679,25 +679,25 @@ /// be removed from the underlying graph, in this case all edges /// incident to the given node is erased from the arc set. /// - /// \param _Graph The type of the graph which shares its node set + /// \param GR The type of the graph which shares its node set /// with this class. Its interface must conform to the /// \ref concepts::Digraph "Digraph" or \ref concepts::Graph "Graph" /// concept. /// /// This class is fully conform to the \ref concepts::Graph "Graph" /// concept. - template - class ListEdgeSet : public EdgeSetExtender > { + template + class ListEdgeSet : public EdgeSetExtender > { public: - typedef EdgeSetExtender > Parent; + typedef EdgeSetExtender > Parent; typedef typename Parent::Node Node; typedef typename Parent::Arc Arc; typedef typename Parent::Edge Edge; - typedef _Graph Graph; + typedef GR Graph; typedef typename Parent::NodesImplBase NodesImplBase; @@ -720,7 +720,7 @@ public: typedef NodesImplBase Parent; - NodesImpl(const Graph& graph, ListEdgeSet& arcset) + NodesImpl(const GR& graph, ListEdgeSet& arcset) : Parent(graph), _arcset(arcset) {} virtual ~NodesImpl() {} @@ -746,15 +746,15 @@ ListEdgeSet& _arcset; }; - NodesImpl nodes; + NodesImpl _nodes; public: /// \brief Constructor of the EdgeSet. /// /// Constructor of the EdgeSet. - ListEdgeSet(const Graph& graph) : nodes(graph, *this) { - Parent::initalize(graph, nodes); + ListEdgeSet(const GR& graph) : _nodes(graph, *this) { + Parent::initalize(graph, _nodes); } /// \brief Add a new edge to the graph. @@ -775,11 +775,11 @@ }; - template + template class SmartArcSetBase { public: - typedef _Graph Graph; + typedef GR Graph; typedef typename Graph::Node Node; typedef typename Graph::NodeIt NodeIt; @@ -790,10 +790,10 @@ NodeT() : first_out(-1), first_in(-1) {} }; - typedef typename ItemSetTraits:: + typedef typename ItemSetTraits:: template Map::Type NodesImplBase; - NodesImplBase* nodes; + NodesImplBase* _nodes; struct ArcT { Node source, target; @@ -803,17 +803,17 @@ std::vector arcs; - const Graph* graph; + const GR* _graph; - void initalize(const Graph& _graph, NodesImplBase& _nodes) { - graph = &_graph; - nodes = &_nodes; + void initalize(const GR& graph, NodesImplBase& nodes) { + _graph = &graph; + _nodes = &nodes; } public: class Arc { - friend class SmartArcSetBase; + friend class SmartArcSetBase; protected: Arc(int _id) : id(_id) {} int id; @@ -830,10 +830,10 @@ Arc addArc(const Node& u, const Node& v) { int n = arcs.size(); arcs.push_back(ArcT()); - arcs[n].next_in = (*nodes)[v].first_in; - (*nodes)[v].first_in = n; - arcs[n].next_out = (*nodes)[u].first_out; - (*nodes)[u].first_out = n; + arcs[n].next_in = (*_nodes)[v].first_in; + (*_nodes)[v].first_in = n; + arcs[n].next_out = (*_nodes)[u].first_out; + (*_nodes)[u].first_out = n; arcs[n].source = u; arcs[n].target = v; return Arc(n); @@ -842,18 +842,18 @@ void clear() { Node node; for (first(node); node != INVALID; next(node)) { - (*nodes)[node].first_in = -1; - (*nodes)[node].first_out = -1; + (*_nodes)[node].first_in = -1; + (*_nodes)[node].first_out = -1; } arcs.clear(); } void first(Node& node) const { - graph->first(node); + _graph->first(node); } void next(Node& node) const { - graph->next(node); + _graph->next(node); } void first(Arc& arc) const { @@ -865,7 +865,7 @@ } void firstOut(Arc& arc, const Node& node) const { - arc.id = (*nodes)[node].first_out; + arc.id = (*_nodes)[node].first_out; } void nextOut(Arc& arc) const { @@ -873,42 +873,42 @@ } void firstIn(Arc& arc, const Node& node) const { - arc.id = (*nodes)[node].first_in; + arc.id = (*_nodes)[node].first_in; } void nextIn(Arc& arc) const { arc.id = arcs[arc.id].next_in; } - int id(const Node& node) const { return graph->id(node); } + int id(const Node& node) const { return _graph->id(node); } int id(const Arc& arc) const { return arc.id; } - Node nodeFromId(int ix) const { return graph->nodeFromId(ix); } + Node nodeFromId(int ix) const { return _graph->nodeFromId(ix); } Arc arcFromId(int ix) const { return Arc(ix); } - int maxNodeId() const { return graph->maxNodeId(); }; + int maxNodeId() const { return _graph->maxNodeId(); }; int maxArcId() const { return arcs.size() - 1; } Node source(const Arc& arc) const { return arcs[arc.id].source;} Node target(const Arc& arc) const { return arcs[arc.id].target;} - typedef typename ItemSetTraits::ItemNotifier NodeNotifier; + typedef typename ItemSetTraits::ItemNotifier NodeNotifier; NodeNotifier& notifier(Node) const { - return graph->notifier(Node()); + return _graph->notifier(Node()); } - template - class NodeMap : public Graph::template NodeMap<_Value> { + template + class NodeMap : public GR::template NodeMap { public: - typedef typename _Graph::template NodeMap<_Value> Parent; + typedef typename GR::template NodeMap Parent; - explicit NodeMap(const SmartArcSetBase& arcset) - : Parent(*arcset.graph) { } + explicit NodeMap(const SmartArcSetBase& arcset) + : Parent(*arcset._graph) { } - NodeMap(const SmartArcSetBase& arcset, const _Value& value) - : Parent(*arcset.graph, value) { } + NodeMap(const SmartArcSetBase& arcset, const V& value) + : Parent(*arcset._graph, value) { } NodeMap& operator=(const NodeMap& cmap) { return operator=(cmap); @@ -937,7 +937,7 @@ /// class. The node handling functions (id handling, observing, and /// iterators) works equivalently as in the original graph. /// - /// \param _Graph The type of the graph which shares its node set with + /// \param GR The type of the graph which shares its node set with /// this class. Its interface must conform to the /// \ref concepts::Digraph "Digraph" or \ref concepts::Graph "Graph" /// concept. @@ -954,17 +954,17 @@ /// /// This class is fully conform to the \ref concepts::Digraph /// "Digraph" concept. - template - class SmartArcSet : public ArcSetExtender > { + template + class SmartArcSet : public ArcSetExtender > { public: - typedef ArcSetExtender > Parent; + typedef ArcSetExtender > Parent; typedef typename Parent::Node Node; typedef typename Parent::Arc Arc; - typedef _Graph Graph; + typedef GR Graph; protected: @@ -986,7 +986,7 @@ public: typedef NodesImplBase Parent; - NodesImpl(const Graph& graph, SmartArcSet& arcset) + NodesImpl(const GR& graph, SmartArcSet& arcset) : Parent(graph), _arcset(arcset) {} virtual ~NodesImpl() {} @@ -1026,15 +1026,15 @@ SmartArcSet& _arcset; }; - NodesImpl nodes; + NodesImpl _nodes; public: /// \brief Constructor of the ArcSet. /// /// Constructor of the ArcSet. - SmartArcSet(const Graph& graph) : nodes(graph, *this) { - Parent::initalize(graph, nodes); + SmartArcSet(const GR& graph) : _nodes(graph, *this) { + Parent::initalize(graph, _nodes); } /// \brief Add a new arc to the digraph. @@ -1052,19 +1052,19 @@ /// invalidated. It occurs when a node in the underlying graph is /// erased and it is not isolated in the ArcSet. bool valid() const { - return nodes.attached(); + return _nodes.attached(); } }; - template + template class SmartEdgeSetBase { public: - typedef _Graph Graph; - typedef typename Graph::Node Node; - typedef typename Graph::NodeIt NodeIt; + typedef GR Graph; + typedef typename GR::Node Node; + typedef typename GR::NodeIt NodeIt; protected: @@ -1073,10 +1073,10 @@ NodeT() : first_out(-1) {} }; - typedef typename ItemSetTraits:: + typedef typename ItemSetTraits:: template Map::Type NodesImplBase; - NodesImplBase* nodes; + NodesImplBase* _nodes; struct ArcT { Node target; @@ -1086,11 +1086,11 @@ std::vector arcs; - const Graph* graph; + const GR* _graph; - void initalize(const Graph& _graph, NodesImplBase& _nodes) { - graph = &_graph; - nodes = &_nodes; + void initalize(const GR& graph, NodesImplBase& nodes) { + _graph = &graph; + _nodes = &nodes; } public: @@ -1135,11 +1135,11 @@ arcs[n].target = u; arcs[n | 1].target = v; - arcs[n].next_out = (*nodes)[v].first_out; - (*nodes)[v].first_out = n; + arcs[n].next_out = (*_nodes)[v].first_out; + (*_nodes)[v].first_out = n; - arcs[n | 1].next_out = (*nodes)[u].first_out; - (*nodes)[u].first_out = (n | 1); + arcs[n | 1].next_out = (*_nodes)[u].first_out; + (*_nodes)[u].first_out = (n | 1); return Edge(n / 2); } @@ -1147,17 +1147,17 @@ void clear() { Node node; for (first(node); node != INVALID; next(node)) { - (*nodes)[node].first_out = -1; + (*_nodes)[node].first_out = -1; } arcs.clear(); } void first(Node& node) const { - graph->first(node); + _graph->first(node); } void next(Node& node) const { - graph->next(node); + _graph->next(node); } void first(Arc& arc) const { @@ -1177,7 +1177,7 @@ } void firstOut(Arc& arc, const Node& node) const { - arc.id = (*nodes)[node].first_out; + arc.id = (*_nodes)[node].first_out; } void nextOut(Arc& arc) const { @@ -1185,7 +1185,7 @@ } void firstIn(Arc& arc, const Node& node) const { - arc.id = (((*nodes)[node].first_out) ^ 1); + arc.id = (((*_nodes)[node].first_out) ^ 1); if (arc.id == -2) arc.id = -1; } @@ -1195,7 +1195,7 @@ } void firstInc(Edge &arc, bool& dir, const Node& node) const { - int de = (*nodes)[node].first_out; + int de = (*_nodes)[node].first_out; if (de != -1 ) { arc.id = de / 2; dir = ((de & 1) == 1); @@ -1223,15 +1223,15 @@ return Arc(edge.id * 2 + (dir ? 1 : 0)); } - int id(Node node) const { return graph->id(node); } + int id(Node node) const { return _graph->id(node); } static int id(Arc arc) { return arc.id; } static int id(Edge arc) { return arc.id; } - Node nodeFromId(int id) const { return graph->nodeFromId(id); } + Node nodeFromId(int id) const { return _graph->nodeFromId(id); } static Arc arcFromId(int id) { return Arc(id); } static Edge edgeFromId(int id) { return Edge(id);} - int maxNodeId() const { return graph->maxNodeId(); }; + int maxNodeId() const { return _graph->maxNodeId(); }; int maxArcId() const { return arcs.size() - 1; } int maxEdgeId() const { return arcs.size() / 2 - 1; } @@ -1241,23 +1241,23 @@ Node u(Edge e) const { return arcs[2 * e.id].target; } Node v(Edge e) const { return arcs[2 * e.id + 1].target; } - typedef typename ItemSetTraits::ItemNotifier NodeNotifier; + typedef typename ItemSetTraits::ItemNotifier NodeNotifier; NodeNotifier& notifier(Node) const { - return graph->notifier(Node()); + return _graph->notifier(Node()); } - template - class NodeMap : public Graph::template NodeMap<_Value> { + template + class NodeMap : public GR::template NodeMap { public: - typedef typename _Graph::template NodeMap<_Value> Parent; + typedef typename GR::template NodeMap Parent; - explicit NodeMap(const SmartEdgeSetBase& arcset) - : Parent(*arcset.graph) { } + explicit NodeMap(const SmartEdgeSetBase& arcset) + : Parent(*arcset._graph) { } - NodeMap(const SmartEdgeSetBase& arcset, const _Value& value) - : Parent(*arcset.graph, value) { } + NodeMap(const SmartEdgeSetBase& arcset, const V& value) + : Parent(*arcset._graph, value) { } NodeMap& operator=(const NodeMap& cmap) { return operator=(cmap); @@ -1285,7 +1285,7 @@ /// node handling functions (id handling, observing, and iterators) /// works equivalently as in the original graph. /// - /// \param _Graph The type of the graph which shares its node set + /// \param GR The type of the graph which shares its node set /// with this class. Its interface must conform to the /// \ref concepts::Digraph "Digraph" or \ref concepts::Graph "Graph" /// concept. @@ -1302,18 +1302,18 @@ /// /// This class is fully conform to the \ref concepts::Graph /// "Graph" concept. - template - class SmartEdgeSet : public EdgeSetExtender > { + template + class SmartEdgeSet : public EdgeSetExtender > { public: - typedef EdgeSetExtender > Parent; + typedef EdgeSetExtender > Parent; typedef typename Parent::Node Node; typedef typename Parent::Arc Arc; typedef typename Parent::Edge Edge; - typedef _Graph Graph; + typedef GR Graph; protected: @@ -1334,7 +1334,7 @@ public: typedef NodesImplBase Parent; - NodesImpl(const Graph& graph, SmartEdgeSet& arcset) + NodesImpl(const GR& graph, SmartEdgeSet& arcset) : Parent(graph), _arcset(arcset) {} virtual ~NodesImpl() {} @@ -1374,15 +1374,15 @@ SmartEdgeSet& _arcset; }; - NodesImpl nodes; + NodesImpl _nodes; public: /// \brief Constructor of the EdgeSet. /// /// Constructor of the EdgeSet. - SmartEdgeSet(const Graph& graph) : nodes(graph, *this) { - Parent::initalize(graph, nodes); + SmartEdgeSet(const GR& graph) : _nodes(graph, *this) { + Parent::initalize(graph, _nodes); } /// \brief Add a new edge to the graph. @@ -1400,7 +1400,7 @@ /// invalidated. It occurs when a node in the underlying graph is /// erased and it is not isolated in the EdgeSet. bool valid() const { - return nodes.attached(); + return _nodes.attached(); } }; diff -r 861a9d5ff283 -r 9b9ffe7d9b75 test/CMakeLists.txt --- a/test/CMakeLists.txt Fri Jan 23 16:42:07 2009 +0000 +++ b/test/CMakeLists.txt Fri Feb 13 13:29:28 2009 +0100 @@ -10,7 +10,7 @@ LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/lemon) SET(TESTS -# adaptors_test + adaptors_test bfs_test circulation_test counter_test @@ -18,7 +18,7 @@ digraph_test dijkstra_test dim_test -# edge_set_test + edge_set_test error_test graph_copy_test graph_test diff -r 861a9d5ff283 -r 9b9ffe7d9b75 test/edge_set_test.cc --- a/test/edge_set_test.cc Fri Jan 23 16:42:07 2009 +0000 +++ b/test/edge_set_test.cc Fri Feb 13 13:29:28 2009 +0100 @@ -33,7 +33,7 @@ using namespace lemon; void checkSmartArcSet() { - checkConcept >(); + checkConcept >(); typedef ListDigraph Digraph; typedef SmartArcSet ArcSet; @@ -99,7 +99,7 @@ } void checkListArcSet() { - checkConcept >(); + checkConcept >(); typedef ListDigraph Digraph; typedef ListArcSet ArcSet; @@ -179,7 +179,7 @@ } void checkSmartEdgeSet() { - checkConcept >(); + checkConcept >(); typedef ListDigraph Digraph; typedef SmartEdgeSet EdgeSet; @@ -263,7 +263,7 @@ } void checkListEdgeSet() { - checkConcept >(); + checkConcept >(); typedef ListDigraph Digraph; typedef ListEdgeSet EdgeSet;