COIN-OR::LEMON - Graph Library

Changeset 287:bb40b6db0a58 in lemon for lemon/dfs.h


Ignore:
Timestamp:
09/27/08 14:33:28 (16 years ago)
Author:
Alpar Juttner <alpar@…>
Branch:
default
Children:
288:47b3a3b67837, 290:f6899946c1ac
Parents:
286:da414906fe21 (diff), 285:d8dc5acf739b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Phase:
public
Message:

Merge

Files:
2 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
  • lemon/dfs.h

    r286 r287  
    5656    ///\param g is the digraph, to which we would like to define the
    5757    ///\ref PredMap.
    58     ///\todo The digraph alone may be insufficient to initialize
    5958    static PredMap *createPredMap(const Digraph &g)
    6059    {
     
    6665    ///The type of the map that indicates which nodes are processed.
    6766    ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
    68     ///By default it is a NullMap.
    6967    typedef NullMap<typename Digraph::Node,bool> ProcessedMap;
    7068    ///Instantiates a \ref ProcessedMap.
     
    197195    int _stack_head;
    198196
    199     ///Creates the maps if necessary.
    200     ///\todo Better memory allocation (instead of new).
     197    //Creates the maps if necessary.
    201198    void create_maps()
    202199    {
     
    783780    ///\param g is the digraph, to which we would like to define the
    784781    ///\ref PredMap.
    785     ///\todo The digraph alone may be insufficient to initialize
    786782    static PredMap *createPredMap(const Digraph &g)
    787783    {
     
    13181314    int _stack_head;
    13191315
    1320     ///Creates the maps if necessary.
    1321     ///\todo Better memory allocation (instead of new).
     1316    //Creates the maps if necessary.
    13221317    void create_maps() {
    13231318      if(!_reached) {
Note: See TracChangeset for help on using the changeset viewer.