COIN-OR::LEMON - Graph Library

Changeset 2335:27aa03cd3121 in lemon-0.x for lemon/dfs.h


Ignore:
Timestamp:
01/08/07 11:39:59 (17 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@3123
Message:

New path concept and path structures

TODO: BellmanFord::negativeCycle()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/dfs.h

    r2260 r2335  
    2626#include <lemon/list_graph.h>
    2727#include <lemon/graph_utils.h>
     28#include <lemon/bits/path_dump.h>
    2829#include <lemon/bits/invalid.h>
    2930#include <lemon/error.h>
     
    653654    ///@{
    654655
    655     ///Copies the path to \c t on the DFS tree into \c p
    656    
    657     ///This function copies the path to \c t on the DFS tree  into \c p.
    658     ///If \c t is a source itself or unreachable, then it does not
    659     ///alter \c p.
    660     ///
    661     ///\return Returns \c true if a path to \c t was actually copied to \c p,
    662     ///\c false otherwise.
    663     ///\sa DirPath
    664     template<class P>
    665     bool getPath(P &p,Node t)
    666     {
    667       if(reached(t)) {
    668         p.clear();
    669         typename P::Builder b(p);
    670         for(b.setStartNode(t);predEdge(t)!=INVALID;t=predNode(t))
    671           b.pushFront(predEdge(t));
    672         b.commit();
    673         return true;
    674       }
    675       return false;
     656    typedef PredMapPath<Graph, PredMap> Path;
     657
     658    ///Gives back the shortest path.
     659   
     660    ///Gives back the shortest path.
     661    ///\pre The \c t should be reachable from the source.
     662    Path path(Node t)
     663    {
     664      return Path(*G, *_pred, t);
    676665    }
    677666
Note: See TracChangeset for help on using the changeset viewer.