diff --git a/lemon/bits/graph_extender.h b/lemon/bits/graph_extender.h --- a/lemon/bits/graph_extender.h +++ b/lemon/bits/graph_extender.h @@ -64,11 +64,11 @@ return Parent::arcFromId(id); } - Node oppositeNode(const Node &n, const Arc &e) const { - if (n == Parent::source(e)) - return Parent::target(e); - else if(n==Parent::target(e)) - return Parent::source(e); + Node oppositeNode(const Node &node, const Arc &arc) const { + if (node == Parent::source(arc)) + return Parent::target(arc); + else if(node == Parent::target(arc)) + return Parent::source(arc); else return INVALID; } @@ -95,22 +95,22 @@ } class NodeIt : public Node { - const Digraph* digraph; + const Digraph* _digraph; public: NodeIt() {} NodeIt(Invalid i) : Node(i) { } - explicit NodeIt(const Digraph& _digraph) : digraph(&_digraph) { - _digraph.first(static_cast(*this)); + explicit NodeIt(const Digraph& digraph) : _digraph(&digraph) { + _digraph->first(static_cast(*this)); } - NodeIt(const Digraph& _digraph, const Node& node) - : Node(node), digraph(&_digraph) {} + NodeIt(const Digraph& digraph, const Node& node) + : Node(node), _digraph(&digraph) {} NodeIt& operator++() { - digraph->next(*this); + _digraph->next(*this); return *this; } @@ -118,22 +118,22 @@ class ArcIt : public Arc { - const Digraph* digraph; + const Digraph* _digraph; public: ArcIt() { } ArcIt(Invalid i) : Arc(i) { } - explicit ArcIt(const Digraph& _digraph) : digraph(&_digraph) { - _digraph.first(static_cast(*this)); + explicit ArcIt(const Digraph& digraph) : _digraph(&digraph) { + _digraph->first(static_cast(*this)); } - ArcIt(const Digraph& _digraph, const Arc& e) : - Arc(e), digraph(&_digraph) { } + ArcIt(const Digraph& digraph, const Arc& arc) : + Arc(arc), _digraph(&digraph) { } ArcIt& operator++() { - digraph->next(*this); + _digraph->next(*this); return *this; } @@ -141,23 +141,23 @@ class OutArcIt : public Arc { - const Digraph* digraph; + const Digraph* _digraph; public: OutArcIt() { } OutArcIt(Invalid i) : Arc(i) { } - OutArcIt(const Digraph& _digraph, const Node& node) - : digraph(&_digraph) { - _digraph.firstOut(*this, node); + OutArcIt(const Digraph& digraph, const Node& node) + : _digraph(&digraph) { + _digraph->firstOut(*this, node); } - OutArcIt(const Digraph& _digraph, const Arc& arc) - : Arc(arc), digraph(&_digraph) {} + OutArcIt(const Digraph& digraph, const Arc& arc) + : Arc(arc), _digraph(&digraph) {} OutArcIt& operator++() { - digraph->nextOut(*this); + _digraph->nextOut(*this); return *this; } @@ -165,23 +165,23 @@ class InArcIt : public Arc { - const Digraph* digraph; + const Digraph* _digraph; public: InArcIt() { } InArcIt(Invalid i) : Arc(i) { } - InArcIt(const Digraph& _digraph, const Node& node) - : digraph(&_digraph) { - _digraph.firstIn(*this, node); + InArcIt(const Digraph& digraph, const Node& node) + : _digraph(&digraph) { + _digraph->firstIn(*this, node); } - InArcIt(const Digraph& _digraph, const Arc& arc) : - Arc(arc), digraph(&_digraph) {} + InArcIt(const Digraph& digraph, const Arc& arc) : + Arc(arc), _digraph(&digraph) {} InArcIt& operator++() { - digraph->nextIn(*this); + _digraph->nextIn(*this); return *this; } @@ -190,29 +190,29 @@ /// \brief Base node of the iterator /// /// Returns the base node (i.e. the source in this case) of the iterator - Node baseNode(const OutArcIt &e) const { - return Parent::source(e); + Node baseNode(const OutArcIt &arc) const { + return Parent::source(arc); } /// \brief Running node of the iterator /// /// Returns the running node (i.e. the target in this case) of the /// iterator - Node runningNode(const OutArcIt &e) const { - return Parent::target(e); + Node runningNode(const OutArcIt &arc) const { + return Parent::target(arc); } /// \brief Base node of the iterator /// /// Returns the base node (i.e. the target in this case) of the iterator - Node baseNode(const InArcIt &e) const { - return Parent::target(e); + Node baseNode(const InArcIt &arc) const { + return Parent::target(arc); } /// \brief Running node of the iterator /// /// Returns the running node (i.e. the source in this case) of the /// iterator - Node runningNode(const InArcIt &e) const { - return Parent::source(e); + Node runningNode(const InArcIt &arc) const { + return Parent::source(arc); } @@ -324,7 +324,7 @@ } }; - /// \ingroup graphbits + /// \ingroup _graphbits /// /// \brief Extender for the Graphs template @@ -332,7 +332,7 @@ public: typedef Base Parent; - typedef GraphExtender Digraph; + typedef GraphExtender Graph; typedef True UndirectedTag; @@ -375,13 +375,13 @@ return INVALID; } - Arc oppositeArc(const Arc &e) const { - return Parent::direct(e, !Parent::direction(e)); + Arc oppositeArc(const Arc &arc) const { + return Parent::direct(arc, !Parent::direction(arc)); } using Parent::direct; - Arc direct(const Edge &ue, const Node &s) const { - return Parent::direct(ue, Parent::source(ue) == s); + Arc direct(const Edge &edge, const Node &node) const { + return Parent::direct(edge, Parent::source(edge) == node); } // Alterable extension @@ -414,22 +414,22 @@ class NodeIt : public Node { - const Digraph* digraph; + const Graph* _graph; public: NodeIt() {} NodeIt(Invalid i) : Node(i) { } - explicit NodeIt(const Digraph& _digraph) : digraph(&_digraph) { - _digraph.first(static_cast(*this)); + explicit NodeIt(const Graph& graph) : _graph(&graph) { + _graph->first(static_cast(*this)); } - NodeIt(const Digraph& _digraph, const Node& node) - : Node(node), digraph(&_digraph) {} + NodeIt(const Graph& graph, const Node& node) + : Node(node), _graph(&graph) {} NodeIt& operator++() { - digraph->next(*this); + _graph->next(*this); return *this; } @@ -437,22 +437,22 @@ class ArcIt : public Arc { - const Digraph* digraph; + const Graph* _graph; public: ArcIt() { } ArcIt(Invalid i) : Arc(i) { } - explicit ArcIt(const Digraph& _digraph) : digraph(&_digraph) { - _digraph.first(static_cast(*this)); + explicit ArcIt(const Graph& graph) : _graph(&graph) { + _graph->first(static_cast(*this)); } - ArcIt(const Digraph& _digraph, const Arc& e) : - Arc(e), digraph(&_digraph) { } + ArcIt(const Graph& graph, const Arc& arc) : + Arc(arc), _graph(&graph) { } ArcIt& operator++() { - digraph->next(*this); + _graph->next(*this); return *this; } @@ -460,23 +460,23 @@ class OutArcIt : public Arc { - const Digraph* digraph; + const Graph* _graph; public: OutArcIt() { } OutArcIt(Invalid i) : Arc(i) { } - OutArcIt(const Digraph& _digraph, const Node& node) - : digraph(&_digraph) { - _digraph.firstOut(*this, node); + OutArcIt(const Graph& graph, const Node& node) + : _graph(&graph) { + _graph->firstOut(*this, node); } - OutArcIt(const Digraph& _digraph, const Arc& arc) - : Arc(arc), digraph(&_digraph) {} + OutArcIt(const Graph& graph, const Arc& arc) + : Arc(arc), _graph(&graph) {} OutArcIt& operator++() { - digraph->nextOut(*this); + _graph->nextOut(*this); return *this; } @@ -484,23 +484,23 @@ class InArcIt : public Arc { - const Digraph* digraph; + const Graph* _graph; public: InArcIt() { } InArcIt(Invalid i) : Arc(i) { } - InArcIt(const Digraph& _digraph, const Node& node) - : digraph(&_digraph) { - _digraph.firstIn(*this, node); + InArcIt(const Graph& graph, const Node& node) + : _graph(&graph) { + _graph->firstIn(*this, node); } - InArcIt(const Digraph& _digraph, const Arc& arc) : - Arc(arc), digraph(&_digraph) {} + InArcIt(const Graph& graph, const Arc& arc) : + Arc(arc), _graph(&graph) {} InArcIt& operator++() { - digraph->nextIn(*this); + _graph->nextIn(*this); return *this; } @@ -508,48 +508,48 @@ class EdgeIt : public Parent::Edge { - const Digraph* digraph; + const Graph* _graph; public: EdgeIt() { } EdgeIt(Invalid i) : Edge(i) { } - explicit EdgeIt(const Digraph& _digraph) : digraph(&_digraph) { - _digraph.first(static_cast(*this)); + explicit EdgeIt(const Graph& graph) : _graph(&graph) { + _graph->first(static_cast(*this)); } - EdgeIt(const Digraph& _digraph, const Edge& e) : - Edge(e), digraph(&_digraph) { } + EdgeIt(const Graph& graph, const Edge& edge) : + Edge(edge), _graph(&graph) { } EdgeIt& operator++() { - digraph->next(*this); + _graph->next(*this); return *this; } }; - class IncArcIt : public Parent::Edge { + class IncEdgeIt : public Parent::Edge { friend class GraphExtender; - const Digraph* digraph; - bool direction; + const Graph* _graph; + bool _direction; public: - IncArcIt() { } + IncEdgeIt() { } - IncArcIt(Invalid i) : Edge(i), direction(false) { } + IncEdgeIt(Invalid i) : Edge(i), _direction(false) { } - IncArcIt(const Digraph& _digraph, const Node &n) : digraph(&_digraph) { - _digraph.firstInc(*this, direction, n); + IncEdgeIt(const Graph& graph, const Node &node) : _graph(&graph) { + _graph->firstInc(*this, _direction, node); } - IncArcIt(const Digraph& _digraph, const Edge &ue, const Node &n) - : digraph(&_digraph), Edge(ue) { - direction = (_digraph.source(ue) == n); + IncEdgeIt(const Graph& graph, const Edge &edge, const Node &node) + : _graph(&graph), Edge(edge) { + _direction = (_graph->source(edge) == node); } - IncArcIt& operator++() { - digraph->nextInc(*this, direction); + IncEdgeIt& operator++() { + _graph->nextInc(*this, _direction); return *this; } }; @@ -557,57 +557,57 @@ /// \brief Base node of the iterator /// /// Returns the base node (ie. the source in this case) of the iterator - Node baseNode(const OutArcIt &e) const { - return Parent::source(static_cast(e)); + Node baseNode(const OutArcIt &arc) const { + return Parent::source(static_cast(arc)); } /// \brief Running node of the iterator /// /// Returns the running node (ie. the target in this case) of the /// iterator - Node runningNode(const OutArcIt &e) const { - return Parent::target(static_cast(e)); + Node runningNode(const OutArcIt &arc) const { + return Parent::target(static_cast(arc)); } /// \brief Base node of the iterator /// /// Returns the base node (ie. the target in this case) of the iterator - Node baseNode(const InArcIt &e) const { - return Parent::target(static_cast(e)); + Node baseNode(const InArcIt &arc) const { + return Parent::target(static_cast(arc)); } /// \brief Running node of the iterator /// /// Returns the running node (ie. the source in this case) of the /// iterator - Node runningNode(const InArcIt &e) const { - return Parent::source(static_cast(e)); + Node runningNode(const InArcIt &arc) const { + return Parent::source(static_cast(arc)); } /// Base node of the iterator /// /// Returns the base node of the iterator - Node baseNode(const IncArcIt &e) const { - return e.direction ? source(e) : target(e); + Node baseNode(const IncEdgeIt &edge) const { + return edge._direction ? source(edge) : target(edge); } /// Running node of the iterator /// /// Returns the running node of the iterator - Node runningNode(const IncArcIt &e) const { - return e.direction ? target(e) : source(e); + Node runningNode(const IncEdgeIt &edge) const { + return edge._direction ? target(edge) : source(edge); } // Mappable extension template class NodeMap - : public MapExtender > { + : public MapExtender > { public: - typedef GraphExtender Digraph; - typedef MapExtender > Parent; + typedef GraphExtender Graph; + typedef MapExtender > Parent; - NodeMap(const Digraph& digraph) - : Parent(digraph) {} - NodeMap(const Digraph& digraph, const _Value& value) - : Parent(digraph, value) {} + NodeMap(const Graph& graph) + : Parent(graph) {} + NodeMap(const Graph& graph, const _Value& value) + : Parent(graph, value) {} NodeMap& operator=(const NodeMap& cmap) { return operator=(cmap); @@ -623,15 +623,15 @@ template class ArcMap - : public MapExtender > { + : public MapExtender > { public: - typedef GraphExtender Digraph; - typedef MapExtender > Parent; + typedef GraphExtender Graph; + typedef MapExtender > Parent; - ArcMap(const Digraph& digraph) - : Parent(digraph) {} - ArcMap(const Digraph& digraph, const _Value& value) - : Parent(digraph, value) {} + ArcMap(const Graph& graph) + : Parent(graph) {} + ArcMap(const Graph& graph, const _Value& value) + : Parent(graph, value) {} ArcMap& operator=(const ArcMap& cmap) { return operator=(cmap); @@ -647,16 +647,16 @@ template class EdgeMap - : public MapExtender > { + : public MapExtender > { public: - typedef GraphExtender Digraph; - typedef MapExtender > Parent; + typedef GraphExtender Graph; + typedef MapExtender > Parent; - EdgeMap(const Digraph& digraph) - : Parent(digraph) {} + EdgeMap(const Graph& graph) + : Parent(graph) {} - EdgeMap(const Digraph& digraph, const _Value& value) - : Parent(digraph, value) {} + EdgeMap(const Graph& graph, const _Value& value) + : Parent(graph, value) {} EdgeMap& operator=(const EdgeMap& cmap) { return operator=(cmap); @@ -695,10 +695,10 @@ Parent::clear(); } - template - void build(const Digraph& digraph, NodeRefMap& nodeRef, + template + void build(const Graph& graph, NodeRefMap& nodeRef, EdgeRefMap& edgeRef) { - Parent::build(digraph, nodeRef, edgeRef); + Parent::build(graph, nodeRef, edgeRef); notifier(Node()).build(); notifier(Edge()).build(); notifier(Arc()).build(); @@ -723,10 +723,10 @@ } void erase(const Edge& edge) { - std::vector ev; - ev.push_back(Parent::direct(edge, true)); - ev.push_back(Parent::direct(edge, false)); - notifier(Arc()).erase(ev); + std::vector av; + av.push_back(Parent::direct(edge, true)); + av.push_back(Parent::direct(edge, false)); + notifier(Arc()).erase(av); notifier(Edge()).erase(edge); Parent::erase(edge); } diff --git a/lemon/concepts/graph.h b/lemon/concepts/graph.h --- a/lemon/concepts/graph.h +++ b/lemon/concepts/graph.h @@ -63,7 +63,7 @@ /// The EdgeIt is an iterator for the edges. We can use /// the EdgeMap to map values for the edges. The InArcIt and /// OutArcIt iterates on the same edges but with opposite - /// direction. The IncArcIt iterates also on the same edges + /// direction. The IncEdgeIt iterates also on the same edges /// as the OutArcIt and InArcIt but it is not convertible to Arc just /// to Edge. class Graph { @@ -270,41 +270,41 @@ /// ///\code /// int count=0; - /// for(Graph::IncArcIt e(g, n); e!=INVALID; ++e) ++count; + /// for(Graph::IncEdgeIt e(g, n); e!=INVALID; ++e) ++count; ///\endcode - class IncArcIt : public Edge { + class IncEdgeIt : public Edge { public: /// Default constructor /// @warning The default constructor sets the iterator /// to an undefined value. - IncArcIt() { } + IncEdgeIt() { } /// Copy constructor. /// Copy constructor. /// - IncArcIt(const IncArcIt& e) : Edge(e) { } + IncEdgeIt(const IncEdgeIt& e) : Edge(e) { } /// Initialize the iterator to be invalid. /// Initialize the iterator to be invalid. /// - IncArcIt(Invalid) { } + IncEdgeIt(Invalid) { } /// This constructor sets the iterator to first incident arc. /// This constructor set the iterator to the first incident arc of /// the node. - IncArcIt(const Graph&, const Node&) { } - /// Edge -> IncArcIt conversion + IncEdgeIt(const Graph&, const Node&) { } + /// Edge -> IncEdgeIt conversion /// Sets the iterator to the value of the trivial iterator \c e. /// This feature necessitates that each time we /// iterate the arc-set, the iteration order is the same. - IncArcIt(const Graph&, const Edge&) { } + IncEdgeIt(const Graph&, const Edge&) { } /// Next incident arc /// Assign the iterator to the next incident arc /// of the corresponding node. - IncArcIt& operator++() { return *this; } + IncEdgeIt& operator++() { return *this; } }; /// The directed arc type. @@ -720,14 +720,14 @@ /// \brief Base node of the iterator /// /// Returns the base node of the iterator - Node baseNode(IncArcIt) const { + Node baseNode(IncEdgeIt) const { return INVALID; } /// \brief Running node of the iterator /// /// Returns the running node of the iterator - Node runningNode(IncArcIt) const { + Node runningNode(IncEdgeIt) const { return INVALID; } diff --git a/lemon/concepts/graph_components.h b/lemon/concepts/graph_components.h --- a/lemon/concepts/graph_components.h +++ b/lemon/concepts/graph_components.h @@ -828,16 +828,16 @@ /// /// This iterator goes trough the incident arcs of a certain /// node of a graph. - typedef GraphIncIt IncArcIt; + typedef GraphIncIt IncEdgeIt; /// \brief The base node of the iterator. /// /// Gives back the base node of the iterator. - Node baseNode(const IncArcIt&) const { return INVALID; } + Node baseNode(const IncEdgeIt&) const { return INVALID; } /// \brief The running node of the iterator. /// /// Gives back the running node of the iterator. - Node runningNode(const IncArcIt&) const { return INVALID; } + Node runningNode(const IncEdgeIt&) const { return INVALID; } /// @} @@ -865,10 +865,10 @@ checkConcept, typename _Graph::EdgeIt >(); checkConcept, typename _Graph::IncArcIt>(); + typename _Graph::Node, 'u'>, typename _Graph::IncEdgeIt>(); typename _Graph::Node n; - typename _Graph::IncArcIt ueit(INVALID); + typename _Graph::IncEdgeIt ueit(INVALID); n = graph.baseNode(ueit); n = graph.runningNode(ueit); }