Index: lemon/dfs.h
===================================================================
--- lemon/dfs.h (revision 281)
+++ lemon/dfs.h (revision 287)
@@ -556,15 +556,15 @@
///
///This method runs the %DFS algorithm from the root node
- ///in order to compute the DFS path to \c dest.
+ ///in order to compute the DFS path to \c t.
///
///The algorithm computes
- ///- the %DFS path to \c dest,
- ///- the distance of \c dest from the root in the %DFS tree.
+ ///- the %DFS path to \c t,
+ ///- the distance of \c t from the root in the %DFS tree.
///
///\pre init() must be called and a root node should be
///added with addSource() before using this function.
- void start(Node dest)
- {
- while ( !emptyQueue() && G->target(_stack[_stack_head])!=dest )
+ void start(Node t)
+ {
+ while ( !emptyQueue() && G->target(_stack[_stack_head])!=t )
processNextArc();
}
@@ -596,5 +596,5 @@
}
- ///Runs the algorithm from the given node.
+ ///Runs the algorithm from the given source node.
///This method runs the %DFS algorithm from node \c s
@@ -620,8 +620,8 @@
///This method runs the %DFS algorithm from node \c s
- ///in order to compute the DFS path to \c t.
- ///
- ///\return The length of the s--t DFS path,
- ///if \c t is reachable form \c s, \c 0 otherwise.
+ ///in order to compute the DFS path to node \c t
+ ///(it stops searching when \c t is processed)
+ ///
+ ///\return \c true if \c t is reachable form \c s.
///
///\note Apart from the return value, d.run(s,t) is
@@ -632,9 +632,9 @@
/// d.start(t);
///\endcode
- int run(Node s,Node t) {
+ bool run(Node s,Node t) {
init();
addSource(s);
start(t);
- return reached(t)?_stack_head+1:0;
+ return reached(t);
}
@@ -1522,14 +1522,14 @@
///
/// This method runs the %DFS algorithm from the root node
- /// in order to compute the DFS path to \c dest.
+ /// in order to compute the DFS path to \c t.
///
/// The algorithm computes
- /// - the %DFS path to \c dest,
- /// - the distance of \c dest from the root in the %DFS tree.
+ /// - the %DFS path to \c t,
+ /// - the distance of \c t from the root in the %DFS tree.
///
/// \pre init() must be called and a root node should be added
/// with addSource() before using this function.
- void start(Node dest) {
- while ( !emptyQueue() && _digraph->target(_stack[_stack_head]) != dest )
+ void start(Node t) {
+ while ( !emptyQueue() && _digraph->target(_stack[_stack_head]) != t )
processNextArc();
}
@@ -1560,5 +1560,5 @@
}
- /// \brief Runs the algorithm from the given node.
+ /// \brief Runs the algorithm from the given source node.
///
/// This method runs the %DFS algorithm from node \c s.
@@ -1584,8 +1584,8 @@
/// This method runs the %DFS algorithm from node \c s
- /// in order to compute the DFS path to \c t.
- ///
- /// \return The length of the s--t DFS path,
- /// if \c t is reachable form \c s, \c 0 otherwise.
+ /// in order to compute the DFS path to node \c t
+ /// (it stops searching when \c t is processed).
+ ///
+ /// \return \c true if \c t is reachable form \c s.
///
/// \note Apart from the return value, d.run(s,t) is
@@ -1596,9 +1596,9 @@
/// d.start(t);
///\endcode
- int run(Node s,Node t) {
+ bool run(Node s,Node t) {
init();
addSource(s);
start(t);
- return reached(t)?_stack_head+1:0;
+ return reached(t);
}