COIN-OR::LEMON - Graph Library

Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/dfs.h

    r281 r287  
    556556    ///
    557557    ///This method runs the %DFS algorithm from the root node
    558     ///in order to compute the DFS path to \c dest.
     558    ///in order to compute the DFS path to \c t.
    559559    ///
    560560    ///The algorithm computes
    561     ///- the %DFS path to \c dest,
    562     ///- the distance of \c dest from the root in the %DFS tree.
     561    ///- the %DFS path to \c t,
     562    ///- the distance of \c t from the root in the %DFS tree.
    563563    ///
    564564    ///\pre init() must be called and a root node should be
    565565    ///added with addSource() before using this function.
    566     void start(Node dest)
    567     {
    568       while ( !emptyQueue() && G->target(_stack[_stack_head])!=dest )
     566    void start(Node t)
     567    {
     568      while ( !emptyQueue() && G->target(_stack[_stack_head])!=t )
    569569        processNextArc();
    570570    }
     
    596596    }
    597597
    598     ///Runs the algorithm from the given node.
     598    ///Runs the algorithm from the given source node.
    599599
    600600    ///This method runs the %DFS algorithm from node \c s
     
    620620
    621621    ///This method runs the %DFS algorithm from node \c s
    622     ///in order to compute the DFS path to \c t.
    623     ///
    624     ///\return The length of the <tt>s</tt>--<tt>t</tt> DFS path,
    625     ///if \c t is reachable form \c s, \c 0 otherwise.
     622    ///in order to compute the DFS path to node \c t
     623    ///(it stops searching when \c t is processed)
     624    ///
     625    ///\return \c true if \c t is reachable form \c s.
    626626    ///
    627627    ///\note Apart from the return value, <tt>d.run(s,t)</tt> is
     
    632632    ///  d.start(t);
    633633    ///\endcode
    634     int run(Node s,Node t) {
     634    bool run(Node s,Node t) {
    635635      init();
    636636      addSource(s);
    637637      start(t);
    638       return reached(t)?_stack_head+1:0;
     638      return reached(t);
    639639    }
    640640
     
    15221522    ///
    15231523    /// This method runs the %DFS algorithm from the root node
    1524     /// in order to compute the DFS path to \c dest.
     1524    /// in order to compute the DFS path to \c t.
    15251525    ///
    15261526    /// The algorithm computes
    1527     /// - the %DFS path to \c dest,
    1528     /// - the distance of \c dest from the root in the %DFS tree.
     1527    /// - the %DFS path to \c t,
     1528    /// - the distance of \c t from the root in the %DFS tree.
    15291529    ///
    15301530    /// \pre init() must be called and a root node should be added
    15311531    /// with addSource() before using this function.
    1532     void start(Node dest) {
    1533       while ( !emptyQueue() && _digraph->target(_stack[_stack_head]) != dest )
     1532    void start(Node t) {
     1533      while ( !emptyQueue() && _digraph->target(_stack[_stack_head]) != t )
    15341534        processNextArc();
    15351535    }
     
    15601560    }
    15611561
    1562     /// \brief Runs the algorithm from the given node.
     1562    /// \brief Runs the algorithm from the given source node.
    15631563    ///
    15641564    /// This method runs the %DFS algorithm from node \c s.
     
    15841584
    15851585    /// This method runs the %DFS algorithm from node \c s
    1586     /// in order to compute the DFS path to \c t.
    1587     ///
    1588     /// \return The length of the <tt>s</tt>--<tt>t</tt> DFS path,
    1589     /// if \c t is reachable form \c s, \c 0 otherwise.
     1586    /// in order to compute the DFS path to node \c t
     1587    /// (it stops searching when \c t is processed).
     1588    ///
     1589    /// \return \c true if \c t is reachable form \c s.
    15901590    ///
    15911591    /// \note Apart from the return value, <tt>d.run(s,t)</tt> is
     
    15961596    ///   d.start(t);
    15971597    ///\endcode
    1598     int run(Node s,Node t) {
     1598    bool run(Node s,Node t) {
    15991599      init();
    16001600      addSource(s);
    16011601      start(t);
    1602       return reached(t)?_stack_head+1:0;
     1602      return reached(t);
    16031603    }
    16041604
Note: See TracChangeset for help on using the changeset viewer.