[Lemon-commits] [lemon_svn] alpar: r1356 - hugo/trunk/src/lemon
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 20:44:49 CET 2006
Author: alpar
Date: Mon Nov 8 16:24:53 2004
New Revision: 1356
Modified:
hugo/trunk/src/lemon/smart_graph.h
Log:
findEdge() declaration went to the right place (for the sake of Doxygen.)
Modified: hugo/trunk/src/lemon/smart_graph.h
==============================================================================
--- hugo/trunk/src/lemon/smart_graph.h (original)
+++ hugo/trunk/src/lemon/smart_graph.h Mon Nov 8 16:24:53 2004
@@ -45,6 +45,10 @@
/// \addtogroup graphs
/// @{
+ ///Base of SmartGraph
+
+ ///Base of SmartGraph
+ ///
class SmartGraphBase {
struct NodeT
@@ -131,22 +135,6 @@
return e;
}
- /// Finds an edge between two nodes.
-
- /// Finds an edge from node \c u to node \c v.
- ///
- /// If \c prev is \ref INVALID (this is the default value), then
- /// It finds the first edge from \c u to \c v. Otherwise it looks for
- /// the next edge from \c u to \c v after \c prev.
- /// \return The found edge or INVALID if there is no such an edge.
- Edge findEdge(Node u,Node v, Edge prev = INVALID)
- {
- int e = (prev.n==-1)? nodes[u.n].first_out : edges[prev.n].next_out;
- while(e!=-1 && edges[e].tail!=v.n) e = edges[e].next_out;
- prev.n=e;
- return prev;
- }
-
void clear() {
edges.clear();
nodes.clear();
@@ -214,6 +202,13 @@
edge.n = edges[edge.n].next_in;
}
+ Edge _findEdge(Node u,Node v, Edge prev = INVALID)
+ {
+ int e = (prev.n==-1)? nodes[u.n].first_out : edges[prev.n].next_out;
+ while(e!=-1 && edges[e].tail!=v.n) e = edges[e].next_out;
+ prev.n=e;
+ return prev;
+ }
};
typedef AlterableGraphExtender<SmartGraphBase> AlterableSmartGraphBase;
@@ -242,7 +237,29 @@
///Of course it should be used as a stack. (Maybe X is not necessary.)
///
///\author Alpar Juttner
- class SmartGraph :public ClearableSmartGraphBase { };
+ class SmartGraph :public ClearableSmartGraphBase {
+ public:
+ /// Finds an edge between two nodes.
+
+ /// Finds an edge from node \c u to node \c v.
+ ///
+ /// If \c prev is \ref INVALID (this is the default value), then
+ /// it finds the first edge from \c u to \c v. Otherwise it looks for
+ /// the next edge from \c u to \c v after \c prev.
+ /// \return The found edge or \ref INVALID if there is no such an edge.
+ ///
+ /// Thus you can iterate through each edge from \c u to \c v as it follows.
+ /// \code
+ /// for(Edge e=G.findEdge(u,v);e!=INVALID;e=G.findEdge(u,v,e)) {
+ /// ...
+ /// }
+ /// \endcode
+ /// \todo Possibly it should be a global function.
+ Edge findEdge(Node u,Node v, Edge prev = INVALID)
+ {
+ return _findEdge(u,v,prev);
+ }
+};
template <>
int countNodes<SmartGraph>(const SmartGraph& graph) {
More information about the Lemon-commits
mailing list