Changeset 1283:fc20371677b9 in lemon-0.x for src/lemon/dijkstra.h
- Timestamp:
- 03/31/05 15:31:39 (19 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1715
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/lemon/dijkstra.h
r1236 r1283 21 21 ///\file 22 22 ///\brief Dijkstra algorithm. 23 /// 24 ///\todo getPath() should be implemented! (also for BFS and DFS) 23 25 24 26 #include <lemon/list_graph.h> … … 656 658 ///@{ 657 659 660 ///Copies the shortest path to \c t into \c p 661 662 ///This function copies the shortest path to \c t into \c p. 663 ///If it \c \t is a source itself or unreachable, then it does not 664 ///alter \c p. 665 ///\todo Is it the right way to handle unreachable nodes? 666 ///\return Returns \c true if a path to \c t was actually copied to \c p, 667 ///\c false otherwise. 668 ///\sa DirPath 669 template<class P> 670 bool getPath(P &p,Node t) 671 { 672 if(reached(t)) { 673 p.clear(); 674 typename P::Builder b(p); 675 for(b.setStartNode(t);pred(t)!=INVALID;t=predNode(t)) 676 b.pushFront(pred(t)); 677 b.commit(); 678 return true; 679 } 680 return false; 681 } 682 658 683 ///The distance of a node from the root. 659 684
Note: See TracChangeset
for help on using the changeset viewer.