Changeset 2059:ebf3b2962554 in lemon-0.x
- Timestamp:
- 04/18/06 09:02:32 (19 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2703
- Location:
- lemon
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/bellman_ford.h
r2042 r2059 421 421 /// \brief Executes one round from the bellman ford algorithm. 422 422 /// 423 /// If the algoritm calculated the distances in the previous round 424 /// strictly for all at most k length paths then it will calculate the 425 /// distances strictly for all at most k + 1 length paths. With k 426 /// iteration this function calculates the at most k length paths. 427 /// \return %True when the algorithm have not found more shorter paths. 423 /// If the algoritm calculated the distances in the previous round 424 /// exactly for all at most \f$ k \f$ length path lengths then it will 425 /// calculate the distances exactly for all at most \f$ k + 1 \f$ 426 /// length path lengths. With \f$ k \f$ iteration this function 427 /// calculates the at most \f$ k \f$ length path lengths. 428 /// 429 /// \warning The paths with limited edge number cannot be retrieved 430 /// easily with \ref getPath() or \ref predEdge() functions. If you 431 /// need the shortest path and not just the distance you should store 432 /// after each iteration the \ref predEdgeMap() map and manually build 433 /// the path. 434 /// 435 /// \return %True when the algorithm have not found more shorter 436 /// paths. 428 437 bool processNextRound() { 429 438 for (int i = 0; i < (int)_process.size(); ++i) { … … 527 536 /// with addSource() before using this function. 528 537 /// 529 /// This method runs the %BellmanFord algorithm from the root node(s) 530 /// in order to compute the shortest path with at most \c length edge 531 /// long paths to each node. The algorithm computes 532 /// - The shortest path tree. 538 /// This method runs the %BellmanFord algorithm from the root 539 /// node(s) in order to compute the shortest path lengths with at 540 /// most \c num edge. 541 /// 542 /// \warning The paths with limited edge number cannot be retrieved 543 /// easily with \ref getPath() or \ref predEdge() functions. If you 544 /// need the shortest path and not just the distance you should store 545 /// after each iteration the \ref predEdgeMap() map and manually build 546 /// the path. 547 /// 548 /// The algorithm computes 549 /// - The predecessor edge from each node. 533 550 /// - The limited distance of each node from the root(s). 534 void limitedStart(int length) {535 for (int i = 0; i < length; ++i) {551 void limitedStart(int num) { 552 for (int i = 0; i < num; ++i) { 536 553 if (processNextRound()) break; 537 554 } -
lemon/edmonds_karp.h
r2037 r2059 42 42 /// constructor. 43 43 /// 44 /// The time complexity of the algorithm is O(n * e^2) in worst case.45 /// Always try the preflow algorithm instead of this if you does not46 /// have some additional reason than to compute the optimal flow which47 /// has O(n^3)time complexity.44 /// The time complexity of the algorithm is \f$ O(n * e^2) \f$ in 45 /// worst case. Always try the preflow algorithm instead of this if 46 /// you does not have some additional reason than to compute the 47 /// optimal flow which has \f$ O(n^3) \f$ time complexity. 48 48 /// 49 49 /// \param _Graph The directed graph type the algorithm runs on. … … 54 54 /// 55 55 /// \author Balazs Dezso 56 #ifdef DOXYGEN 57 template <typename _Graph, typename _Number, 58 typename _CapacityMap, typename _FlowMap, typename _Tolerance> 59 #else 56 60 template <typename _Graph, typename _Number, 57 61 typename _CapacityMap = typename _Graph::template EdgeMap<_Number>, 58 62 typename _FlowMap = typename _Graph::template EdgeMap<_Number>, 59 63 typename _Tolerance = Tolerance<_Number> > 64 #endif 60 65 class EdmondsKarp { 61 66 public: … … 108 113 /// \param flow The flow of the edges. 109 114 /// \param tolerance Tolerance class. 110 /// Except the graph, all of these parameters can be reset by111 /// calling \ref source, \ref target, \ref capacityMap and \ref112 /// flowMap, resp.113 115 EdmondsKarp(const Graph& graph, Node source, Node target, 114 116 const CapacityMap& capacity, FlowMap& flow, … … 240 242 /// 241 243 /// It is just a shorthand for: 242 /// \code 244 /// 245 ///\code 243 246 /// ek.init(); 244 247 /// ek.start(); 245 /// 248 ///\endcode 246 249 void run() { 247 250 init();
Note: See TracChangeset
for help on using the changeset viewer.