Changeset 2335:27aa03cd3121 in lemon0.x for lemon/dijkstra.h
 Timestamp:
 01/08/07 11:39:59 (13 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@3123
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

lemon/dijkstra.h
r2269 r2335 28 28 #include <lemon/list_graph.h> 29 29 #include <lemon/bin_heap.h> 30 #include <lemon/bits/path_dump.h> 30 31 #include <lemon/bits/invalid.h> 31 32 #include <lemon/error.h> 32 33 #include <lemon/maps.h> 34 33 35 34 36 namespace lemon { … … 718 720 ///@{ 719 721 720 ///Copies the shortest path to \c t into \c p 721 722 ///This function copies the shortest path to \c t into \c p. 723 ///If it \c t is a source itself or unreachable, then it does not 724 ///alter \c p. 725 ///\return Returns \c true if a path to \c t was actually copied to \c p, 726 ///\c false otherwise. 727 ///\sa DirPath 728 template<class P> 729 bool getPath(P &p,Node t) 730 { 731 if(reached(t)) { 732 p.clear(); 733 typename P::Builder b(p); 734 for(b.setStartNode(t);predEdge(t)!=INVALID;t=predNode(t)) 735 b.pushFront(predEdge(t)); 736 b.commit(); 737 return true; 738 } 739 return false; 740 } 741 722 typedef PredMapPath<Graph, PredMap> Path; 723 724 ///Gives back the shortest path. 725 726 ///Gives back the shortest path. 727 ///\pre The \c t should be reachable from the source. 728 Path path(Node t) 729 { 730 return Path(*G, *_pred, t); 731 } 732 742 733 ///The distance of a node from the root. 743 734
Note: See TracChangeset
for help on using the changeset viewer.