[Lemon-commits] [lemon_svn] deba: r2574 - in hugo/trunk/lemon: . bits
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 20:53:39 CET 2006
Author: deba
Date: Thu Feb 23 10:03:18 2006
New Revision: 2574
Modified:
hugo/trunk/lemon/bits/graph_extender.h
hugo/trunk/lemon/dfs.h
hugo/trunk/lemon/dijkstra.h
hugo/trunk/lemon/graph_utils.h
Log:
Little bugfixes, spellchecks and improvements
Modified: hugo/trunk/lemon/bits/graph_extender.h
==============================================================================
--- hugo/trunk/lemon/bits/graph_extender.h (original)
+++ hugo/trunk/lemon/bits/graph_extender.h Thu Feb 23 10:03:18 2006
@@ -379,7 +379,7 @@
/// Returns a directed edge corresponding to the specified UEdge.
/// If the given bool is true the given undirected edge and the
/// returned edge have the same source node.
- Edge direct(const UEdge &ue, bool d) const {
+ static Edge direct(const UEdge &ue, bool d) {
return Edge(ue, d);
}
@@ -388,7 +388,7 @@
///
/// \todo reference to the corresponding point of the undirected graph
/// concept. "What does the direction of an undirected edge mean?"
- bool direction(const Edge &e) const { return e.forward; }
+ static bool direction(const Edge &e) { return e.forward; }
using Parent::first;
Modified: hugo/trunk/lemon/dfs.h
==============================================================================
--- hugo/trunk/lemon/dfs.h (original)
+++ hugo/trunk/lemon/dfs.h Thu Feb 23 10:03:18 2006
@@ -573,6 +573,34 @@
while ( !emptyQueue() && !em[_stack[_stack_head]] ) processNextEdge();
}
+ ///Runs %DFS algorithm to visit all nodes in the graph.
+
+ ///This method runs the %DFS algorithm in order to
+ ///compute the
+ ///%DFS path to each node. The algorithm computes
+ ///- The %DFS tree.
+ ///- The distance of each node from the root in the %DFS tree.
+ ///
+ ///\note d.run() is just a shortcut of the following code.
+ ///\code
+ /// d.init();
+ /// for (NodeIt it(graph); it != INVALID; ++it) {
+ /// if (!d.reached(it)) {
+ /// d.addSource(it);
+ /// d.start();
+ /// }
+ /// }
+ ///\endcode
+ void run() {
+ init();
+ for (NodeIt it(*G); it != INVALID; ++it) {
+ if (!reached(it)) {
+ addSource(it);
+ start();
+ }
+ }
+ }
+
///Runs %DFS algorithm from node \c s.
///This method runs the %DFS algorithm from a root node \c s
@@ -651,8 +679,8 @@
///Returns the distance of a node from the root(s).
///\pre \ref run() must be called before using this function.
- ///\warning If node \c v is unreachable from the root(s) then the return value
- ///of this funcion is undefined.
+ ///\warning If node \c v is unreachable from the root(s) then the return
+ ///value of this funcion is undefined.
int dist(Node v) const { return (*_dist)[v]; }
///Returns the 'previous edge' of the %DFS tree.
@@ -1440,7 +1468,7 @@
while (!emptyQueue() && !em[_stack[_stack_head]]) processNextEdge();
}
- /// \brief Runs %DFS algorithm from node \c s.
+ /// \brief Runs %DFSVisit algorithm from node \c s.
///
/// This method runs the %DFS algorithm from a root node \c s.
/// \note d.run(s) is just a shortcut of the following code.
@@ -1454,6 +1482,33 @@
addSource(s);
start();
}
+
+ /// \brief Runs %DFSVisit algorithm to visit all nodes in the graph.
+
+ /// This method runs the %DFS algorithm in order to
+ /// compute the %DFS path to each node. The algorithm computes
+ /// - The %DFS tree.
+ /// - The distance of each node from the root in the %DFS tree.
+ ///
+ ///\note d.run() is just a shortcut of the following code.
+ ///\code
+ /// d.init();
+ /// for (NodeIt it(graph); it != INVALID; ++it) {
+ /// if (!d.reached(it)) {
+ /// d.addSource(it);
+ /// d.start();
+ /// }
+ /// }
+ ///\endcode
+ void run() {
+ init();
+ for (NodeIt it(*_graph); it != INVALID; ++it) {
+ if (!reached(it)) {
+ addSource(it);
+ start();
+ }
+ }
+ }
///@}
/// \name Query Functions
Modified: hugo/trunk/lemon/dijkstra.h
==============================================================================
--- hugo/trunk/lemon/dijkstra.h (original)
+++ hugo/trunk/lemon/dijkstra.h Thu Feb 23 10:03:18 2006
@@ -484,7 +484,7 @@
///Sets the heap and the cross reference used by algorithm.
///If you don't use this function before calling \ref run(),
///it will allocate one. The destuctor deallocates this
- ///automatically allocated map, of course.
+ ///automatically allocated heap and cross reference, of course.
///\return <tt> (*this) </tt>
Dijkstra &heap(Heap& heap, HeapCrossRef &crossRef)
{
Modified: hugo/trunk/lemon/graph_utils.h
==============================================================================
--- hugo/trunk/lemon/graph_utils.h (original)
+++ hugo/trunk/lemon/graph_utils.h Thu Feb 23 10:03:18 2006
@@ -566,7 +566,7 @@
return edgeRefMap;
}
- void run() {}
+ void run() const {}
private:
@@ -777,7 +777,7 @@
return uEdgeRefMap;
}
- void run() {}
+ void run() const {}
private:
More information about the Lemon-commits
mailing list