lemon/dfs.h
 changeset 286 da414906fe21 parent 278 931190050520 child 287 bb40b6db0a58
```     1.1 --- a/lemon/dfs.h	Tue Sep 23 18:42:49 2008 +0200
1.2 +++ b/lemon/dfs.h	Fri Sep 26 12:40:11 2008 +0200
1.3 @@ -558,17 +558,17 @@
1.4      ///Executes the algorithm until the given target node is reached.
1.5      ///
1.6      ///This method runs the %DFS algorithm from the root node
1.7 -    ///in order to compute the DFS path to \c dest.
1.8 +    ///in order to compute the DFS path to \c t.
1.9      ///
1.10      ///The algorithm computes
1.11 -    ///- the %DFS path to \c dest,
1.12 -    ///- the distance of \c dest from the root in the %DFS tree.
1.13 +    ///- the %DFS path to \c t,
1.14 +    ///- the distance of \c t from the root in the %DFS tree.
1.15      ///
1.16      ///\pre init() must be called and a root node should be
1.18 -    void start(Node dest)
1.19 +    void start(Node t)
1.20      {
1.21 -      while ( !emptyQueue() && G->target(_stack[_stack_head])!=dest )
1.22 +      while ( !emptyQueue() && G->target(_stack[_stack_head])!=t )
1.23          processNextArc();
1.24      }
1.25
1.26 @@ -598,7 +598,7 @@
1.27        return emptyQueue() ? INVALID : _stack[_stack_head];
1.28      }
1.29
1.30 -    ///Runs the algorithm from the given node.
1.31 +    ///Runs the algorithm from the given source node.
1.32
1.33      ///This method runs the %DFS algorithm from node \c s
1.34      ///in order to compute the DFS path to each node.
1.35 @@ -622,10 +622,10 @@
1.36      ///Finds the %DFS path between \c s and \c t.
1.37
1.38      ///This method runs the %DFS algorithm from node \c s
1.39 -    ///in order to compute the DFS path to \c t.
1.40 +    ///in order to compute the DFS path to node \c t
1.41 +    ///(it stops searching when \c t is processed)
1.42      ///
1.43 -    ///\return The length of the <tt>s</tt>--<tt>t</tt> DFS path,
1.44 -    ///if \c t is reachable form \c s, \c 0 otherwise.
1.45 +    ///\return \c true if \c t is reachable form \c s.
1.46      ///
1.47      ///\note Apart from the return value, <tt>d.run(s,t)</tt> is
1.48      ///just a shortcut of the following code.
1.49 @@ -634,11 +634,11 @@
1.51      ///  d.start(t);
1.52      ///\endcode
1.53 -    int run(Node s,Node t) {
1.54 +    bool run(Node s,Node t) {
1.55        init();
1.57        start(t);
1.59 +      return reached(t);
1.60      }
1.61
1.62      ///Runs the algorithm to visit all nodes in the digraph.
1.63 @@ -1526,16 +1526,16 @@
1.64      /// Executes the algorithm until the given target node is reached.
1.65      ///
1.66      /// This method runs the %DFS algorithm from the root node
1.67 -    /// in order to compute the DFS path to \c dest.
1.68 +    /// in order to compute the DFS path to \c t.
1.69      ///
1.70      /// The algorithm computes
1.71 -    /// - the %DFS path to \c dest,
1.72 -    /// - the distance of \c dest from the root in the %DFS tree.
1.73 +    /// - the %DFS path to \c t,
1.74 +    /// - the distance of \c t from the root in the %DFS tree.
1.75      ///
1.76      /// \pre init() must be called and a root node should be added
1.77      /// with addSource() before using this function.
1.78 -    void start(Node dest) {
1.79 -      while ( !emptyQueue() && _digraph->target(_stack[_stack_head]) != dest )
1.80 +    void start(Node t) {
1.81 +      while ( !emptyQueue() && _digraph->target(_stack[_stack_head]) != t )
1.82          processNextArc();
1.83      }
1.84
1.85 @@ -1564,7 +1564,7 @@
1.86        return emptyQueue() ? INVALID : _stack[_stack_head];
1.87      }
1.88
1.89 -    /// \brief Runs the algorithm from the given node.
1.90 +    /// \brief Runs the algorithm from the given source node.
1.91      ///
1.92      /// This method runs the %DFS algorithm from node \c s.
1.93      /// in order to compute the DFS path to each node.
1.94 @@ -1588,10 +1588,10 @@
1.95      /// \brief Finds the %DFS path between \c s and \c t.
1.96
1.97      /// This method runs the %DFS algorithm from node \c s
1.98 -    /// in order to compute the DFS path to \c t.
1.99 +    /// in order to compute the DFS path to node \c t
1.100 +    /// (it stops searching when \c t is processed).
1.101      ///
1.102 -    /// \return The length of the <tt>s</tt>--<tt>t</tt> DFS path,
1.103 -    /// if \c t is reachable form \c s, \c 0 otherwise.
1.104 +    /// \return \c true if \c t is reachable form \c s.
1.105      ///
1.106      /// \note Apart from the return value, <tt>d.run(s,t)</tt> is
1.107      /// just a shortcut of the following code.
1.108 @@ -1600,11 +1600,11 @@