Changeset 2335:27aa03cd3121 in lemon-0.x for lemon/bfs.h
- Timestamp:
- 01/08/07 11:39:59 (16 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@3123
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/bfs.h
r2307 r2335 26 26 #include <lemon/list_graph.h> 27 27 #include <lemon/graph_utils.h> 28 #include <lemon/bits/path_dump.h> 28 29 #include <lemon/bits/invalid.h> 29 30 #include <lemon/error.h> … … 677 678 ///@{ 678 679 679 ///Copies the shortest path to \c t into \c p 680 681 ///This function copies the shortest path to \c t into \c p. 682 ///If \c t is a source itself or unreachable, then it does not 683 ///alter \c p. 684 ///\return Returns \c true if a path to \c t was actually copied to \c p, 685 ///\c false otherwise. 686 ///\sa DirPath 687 template<class P> 688 bool getPath(P &p,Node t) 689 { 690 if(reached(t)) { 691 p.clear(); 692 typename P::Builder b(p); 693 for(b.setStartNode(t);predEdge(t)!=INVALID;t=predNode(t)) 694 b.pushFront(predEdge(t)); 695 b.commit(); 696 return true; 697 } 698 return false; 680 typedef PredMapPath<Graph, PredMap> Path; 681 682 ///Gives back the shortest path. 683 684 ///Gives back the shortest path. 685 ///\pre The \c t should be reachable from the source. 686 Path path(Node t) 687 { 688 return Path(*G, *_pred, t); 699 689 } 700 690
Note: See TracChangeset
for help on using the changeset viewer.