diff -r c1e936e6a46b -r 27aa03cd3121 lemon/bfs.h --- a/lemon/bfs.h Fri Jan 05 10:59:18 2007 +0000 +++ b/lemon/bfs.h Mon Jan 08 10:39:59 2007 +0000 @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -676,26 +677,15 @@ ///@{ - ///Copies the shortest path to \c t into \c p + typedef PredMapPath Path; + + ///Gives back the shortest path. - ///This function copies the shortest path to \c t into \c p. - ///If \c t is a source itself or unreachable, then it does not - ///alter \c p. - ///\return Returns \c true if a path to \c t was actually copied to \c p, - ///\c false otherwise. - ///\sa DirPath - template - bool getPath(P &p,Node t) + ///Gives back the shortest path. + ///\pre The \c t should be reachable from the source. + Path path(Node t) { - if(reached(t)) { - p.clear(); - typename P::Builder b(p); - for(b.setStartNode(t);predEdge(t)!=INVALID;t=predNode(t)) - b.pushFront(predEdge(t)); - b.commit(); - return true; - } - return false; + return Path(*G, *_pred, t); } ///The distance of a node from the root(s).