# HG changeset patch # User deba # Date 1120497723 0 # Node ID 777834118f73a2d451a27883f508aed0b91724c5 # Parent 0d9f1a71be27b9755ea2d976ee85a9a4545aee71 NewUndirEdgeSetAdaptor class some doc some bug fix diff -r 0d9f1a71be27 -r 777834118f73 lemon/graph_adaptor.h --- a/lemon/graph_adaptor.h Mon Jul 04 17:16:05 2005 +0000 +++ b/lemon/graph_adaptor.h Mon Jul 04 17:22:03 2005 +0000 @@ -1215,7 +1215,6 @@ }; - /// \e template class NewEdgeSetAdaptorBase { public: @@ -1413,6 +1412,20 @@ }; + + /// \brief Graph adaptor using a node set of another graph and an + /// own edge set. + /// + /// This structure can be used to establish another graph over a node set + /// of an existing one. The node iterator will go through the nodes of the + /// original graph. + /// + /// \param _Graph The type of the graph which shares its node set with + /// this class. Its interface must conform to the \ref skeleton::StaticGraph + /// "StaticGraph" concept. + /// + /// In the edge extension and removing it conforms to the + /// \ref skeleton::ExtendableGraph "ExtendableGraph" concept. template class NewEdgeSetAdaptor : public ErasableGraphExtender< @@ -1475,16 +1488,115 @@ public: + /// \brief Constructor of the adaptor. + /// + /// Constructor of the adaptor. NewEdgeSetAdaptor(const _Graph& _graph) : nodes(*this, _graph) { Parent::initalize(_graph, nodes); } void clear() { + Parent::getNotifier(Edge()).clear(); + Parent::edges.clear(); Parent::first_edge = -1; Parent::first_free_edge = -1; + } + + }; + /// \brief Graph adaptor using a node set of another graph and an + /// own undir edge set. + /// + /// This structure can be used to establish another undirected graph over + /// a node set of an existing one. The node iterator will go through the + /// nodes of the original graph. + /// + /// \param _Graph The type of the graph which shares its node set with + /// this class. Its interface must conform to the \ref skeleton::StaticGraph + /// "StaticGraph" concept. + /// + /// In the edge extension and removing it conforms to the + /// \ref skeleton::ExtendableGraph "ExtendableGraph" concept. + template + class NewUndirEdgeSetAdaptor : + public ErasableUndirGraphExtender< + ClearableUndirGraphExtender< + ExtendableUndirGraphExtender< + MappableUndirGraphExtender< + IterableUndirGraphExtender< + AlterableUndirGraphExtender< + UndirGraphExtender< + NewEdgeSetAdaptorBase<_Graph> > > > > > > > { + + public: + + typedef ErasableUndirGraphExtender< + ClearableUndirGraphExtender< + ExtendableUndirGraphExtender< + MappableUndirGraphExtender< + IterableUndirGraphExtender< + AlterableUndirGraphExtender< + UndirGraphExtender< + NewEdgeSetAdaptorBase<_Graph> > > > > > > > Parent; + + + typedef typename Parent::Node Node; + typedef typename Parent::Edge Edge; + typedef typename Parent::UndirEdge UndirEdge; + + private: + + virtual void _clear() { + Parent::edges.clear(); + Parent::first_edge = -1; + Parent::first_free_edge = -1; + Parent::getNotifier(Edge()).clear(); + Parent::getNotifier(Node()).clear(); + } + + virtual void _add(const Node& node) { + Parent::getNotifier(Node()).add(node); + } + + virtual void _erase(const Node& node) { + Edge edge; + Parent::firstOut(edge, node); + while (edge != INVALID) { + Parent::erase(edge); + Parent::firstOut(edge, node); + } + + Parent::firstIn(edge, node); + while (edge != INVALID) { + Parent::erase(edge); + Parent::firstIn(edge, node); + } + + Parent::getNotifier(Node()).erase(node); + } + + typedef typename Parent::NodesImpl NodesImpl; + + NodesImpl nodes; + + public: + + + /// \brief Constructor of the adaptor. + /// + /// Constructor of the adaptor. + NewUndirEdgeSetAdaptor(const _Graph& _graph) : nodes(*this, _graph) { + Parent::initalize(_graph, nodes); + } + + void clear() { Parent::getNotifier(Edge()).clear(); + Parent::getNotifier(UndirEdge()).clear(); + + Parent::edges.clear(); + Parent::first_edge = -1; + Parent::first_free_edge = -1; } }; diff -r 0d9f1a71be27 -r 777834118f73 lemon/graph_utils.h --- a/lemon/graph_utils.h Mon Jul 04 17:16:05 2005 +0000 +++ b/lemon/graph_utils.h Mon Jul 04 17:22:03 2005 +0000 @@ -739,6 +739,8 @@ Map::clear(); } + public: + /// \brief Gives back the \e descriptor of the item. /// /// Gives back the mutable and unique \e descriptor of the map.