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(); } };