[Lemon-commits] [lemon_svn] deba: r2030 - hugo/trunk/lemon
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 20:49:38 CET 2006
Author: deba
Date: Mon Jul 4 19:22:03 2005
New Revision: 2030
Modified:
hugo/trunk/lemon/graph_adaptor.h
hugo/trunk/lemon/graph_utils.h
Log:
NewUndirEdgeSetAdaptor class
some doc
some bug fix
Modified: hugo/trunk/lemon/graph_adaptor.h
==============================================================================
--- hugo/trunk/lemon/graph_adaptor.h (original)
+++ hugo/trunk/lemon/graph_adaptor.h Mon Jul 4 19:22:03 2005
@@ -1215,7 +1215,6 @@
};
- /// \e
template <typename _Graph>
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 <typename _Graph>
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 <typename _Graph>
+ 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;
}
};
Modified: hugo/trunk/lemon/graph_utils.h
==============================================================================
--- hugo/trunk/lemon/graph_utils.h (original)
+++ hugo/trunk/lemon/graph_utils.h Mon Jul 4 19:22:03 2005
@@ -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.
More information about the Lemon-commits
mailing list