lemon/dag_shortest_path.h
changeset 2335 27aa03cd3121
parent 2260 4274224f8a7d
child 2391 14a343be7a5a
     1.1 --- a/lemon/dag_shortest_path.h	Fri Jan 05 10:59:18 2007 +0000
     1.2 +++ b/lemon/dag_shortest_path.h	Mon Jan 08 10:39:59 2007 +0000
     1.3 @@ -722,26 +722,15 @@
     1.4      
     1.5      ///@{
     1.6  
     1.7 -    /// \brief Copies the shortest path to \c t into \c p
     1.8 -    ///    
     1.9 -    /// This function copies the shortest path to \c t into \c p.
    1.10 -    /// If it \c t is a source itself or unreachable, then it does not
    1.11 -    /// alter \c p.
    1.12 -    ///
    1.13 -    /// \return Returns \c true if a path to \c t was actually copied to \c p,
    1.14 -    /// \c false otherwise.
    1.15 -    /// \sa DirPath
    1.16 -    template <typename Path>
    1.17 -    bool getPath(Path &p, Node t) {
    1.18 -      if(reached(t)) {
    1.19 -	p.clear();
    1.20 -	typename Path::Builder b(p);
    1.21 -	for(b.setStartNode(t);predEdge(t)!=INVALID;t=predNode(t))
    1.22 -	  b.pushFront(predEdge(t));
    1.23 -	b.commit();
    1.24 -	return true;
    1.25 -      }
    1.26 -      return false;
    1.27 +    typedef PredMapPath<Graph, PredMap> Path;
    1.28 +
    1.29 +    ///Gives back the shortest path.
    1.30 +    
    1.31 +    ///Gives back the shortest path.
    1.32 +    ///\pre The \c t should be reachable from the source.
    1.33 +    Path path(Node t) 
    1.34 +    {
    1.35 +      return Path(*graph, *_pred, t);
    1.36      }
    1.37  	  
    1.38      /// \brief The distance of a node from the root.