COIN-OR::LEMON - Graph Library

Changeset 287:bb40b6db0a58 in lemon-1.0 for lemon/bfs.h


Ignore:
Timestamp:
09/27/08 14:33:28 (11 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/bfs.h

    r281 r287  
    605605    ///
    606606    ///This method runs the %BFS algorithm from the root node(s)
    607     ///in order to compute the shortest path to \c dest.
     607    ///in order to compute the shortest path to \c t.
    608608    ///
    609609    ///The algorithm computes
    610     ///- the shortest path to \c dest,
    611     ///- the distance of \c dest from the root(s).
     610    ///- the shortest path to \c t,
     611    ///- the distance of \c t from the root(s).
    612612    ///
    613613    ///\pre init() must be called and at least one root node should be
     
    621621    ///  }
    622622    ///\endcode
    623     void start(Node dest)
     623    void start(Node t)
    624624    {
    625625      bool reach = false;
    626       while ( !emptyQueue() && !reach ) processNextNode(dest, reach);
     626      while ( !emptyQueue() && !reach ) processNextNode(t, reach);
    627627    }
    628628
     
    662662    }
    663663
    664     ///Runs the algorithm from the given node.
     664    ///Runs the algorithm from the given source node.
    665665
    666666    ///This method runs the %BFS algorithm from node \c s
     
    686686
    687687    ///This method runs the %BFS algorithm from node \c s
    688     ///in order to compute the shortest path to \c t.
    689     ///
    690     ///\return The length of the shortest <tt>s</tt>--<tt>t</tt> path,
    691     ///if \c t is reachable form \c s, \c 0 otherwise.
     688    ///in order to compute the shortest path to node \c t
     689    ///(it stops searching when \c t is processed).
     690    ///
     691    ///\return \c true if \c t is reachable form \c s.
    692692    ///
    693693    ///\note Apart from the return value, <tt>b.run(s,t)</tt> is just a
     
    698698    ///  b.start(t);
    699699    ///\endcode
    700     int run(Node s,Node t) {
     700    bool run(Node s,Node t) {
    701701      init();
    702702      addSource(s);
    703703      start(t);
    704       return reached(t) ? _curr_dist : 0;
     704      return reached(t);
    705705    }
    706706
     
    16171617    ///
    16181618    /// This method runs the %BFS algorithm from the root node(s)
    1619     /// in order to compute the shortest path to \c dest.
     1619    /// in order to compute the shortest path to \c t.
    16201620    ///
    16211621    /// The algorithm computes
    1622     /// - the shortest path to \c dest,
    1623     /// - the distance of \c dest from the root(s).
     1622    /// - the shortest path to \c t,
     1623    /// - the distance of \c t from the root(s).
    16241624    ///
    16251625    /// \pre init() must be called and at least one root node should be
     
    16331633    ///   }
    16341634    /// \endcode
    1635     void start(Node dest) {
     1635    void start(Node t) {
    16361636      bool reach = false;
    1637       while ( !emptyQueue() && !reach ) processNextNode(dest, reach);
     1637      while ( !emptyQueue() && !reach ) processNextNode(t, reach);
    16381638    }
    16391639
     
    16731673    }
    16741674
    1675     /// \brief Runs the algorithm from the given node.
     1675    /// \brief Runs the algorithm from the given source node.
    16761676    ///
    16771677    /// This method runs the %BFS algorithm from node \c s
     
    16921692      addSource(s);
    16931693      start();
     1694    }
     1695
     1696    /// \brief Finds the shortest path between \c s and \c t.
     1697    ///
     1698    /// This method runs the %BFS algorithm from node \c s
     1699    /// in order to compute the shortest path to node \c t
     1700    /// (it stops searching when \c t is processed).
     1701    ///
     1702    /// \return \c true if \c t is reachable form \c s.
     1703    ///
     1704    /// \note Apart from the return value, <tt>b.run(s,t)</tt> is just a
     1705    /// shortcut of the following code.
     1706    ///\code
     1707    ///   b.init();
     1708    ///   b.addSource(s);
     1709    ///   b.start(t);
     1710    ///\endcode
     1711    bool run(Node s,Node t) {
     1712      init();
     1713      addSource(s);
     1714      start(t);
     1715      return reached(t);
    16941716    }
    16951717
  • lemon/bfs.h

    r286 r287  
    5555    ///\param g is the digraph, to which we would like to define the
    5656    ///\ref PredMap.
    57     ///\todo The digraph alone may be insufficient to initialize
    5857    static PredMap *createPredMap(const Digraph &g)
    5958    {
     
    6564    ///The type of the map that indicates which nodes are processed.
    6665    ///It must meet the \ref concepts::WriteMap "WriteMap" concept.
    67     ///By default it is a NullMap.
    6866    typedef NullMap<typename Digraph::Node,bool> ProcessedMap;
    6967    ///Instantiates a \ref ProcessedMap.
     
    197195    int _curr_dist;
    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    {
     
    849846    ///\param g is the digraph, to which we would like to define the
    850847    ///\ref PredMap.
    851     ///\todo The digraph alone may be insufficient to initialize
    852848    static PredMap *createPredMap(const Digraph &g)
    853849    {
     
    13711367    int _list_front, _list_back;
    13721368
    1373     ///Creates the maps if necessary.
    1374     ///\todo Better memory allocation (instead of new).
     1369    //Creates the maps if necessary.
    13751370    void create_maps() {
    13761371      if(!_reached) {
Note: See TracChangeset for help on using the changeset viewer.