Changeset 2335:27aa03cd3121 in lemon-0.x for lemon/floyd_warshall.h
- Timestamp:
- 01/08/07 11:39:59 (17 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@3123
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/floyd_warshall.h
r2260 r2335 27 27 #include <lemon/list_graph.h> 28 28 #include <lemon/graph_utils.h> 29 #include <lemon/bits/path_dump.h> 29 30 #include <lemon/bits/invalid.h> 30 31 #include <lemon/error.h> … … 481 482 ///@{ 482 483 483 /// \brief Copies the shortest path to \c t into \c p 484 /// 485 /// This function copies the shortest path to \c t into \c p. 486 /// If it \c t is a source itself or unreachable, then it does not 487 /// alter \c p. 488 /// \return Returns \c true if a path to \c t was actually copied to \c p, 489 /// \c false otherwise. 490 /// \sa DirPath 491 template <typename Path> 492 bool getPath(Path &p, Node source, Node target) { 493 if (connected(source, target)) { 494 p.clear(); 495 typename Path::Builder b(target); 496 for(b.setStartNode(target); predEdge(source, target) != INVALID; 497 target = predNode(target)) { 498 b.pushFront(predEdge(source, target)); 499 } 500 b.commit(); 501 return true; 502 } 503 return false; 484 typedef PredMatrixMapPath<Graph, PredMap> Path; 485 486 ///Gives back the shortest path. 487 488 ///Gives back the shortest path. 489 ///\pre The \c t should be reachable from the \c t. 490 Path path(Node s, Node t) 491 { 492 return Path(*graph, *_pred, s, t); 504 493 } 505 494
Note: See TracChangeset
for help on using the changeset viewer.