1.1 --- a/lemon/bellman_ford.h Tue Apr 18 07:01:55 2006 +0000
1.2 +++ b/lemon/bellman_ford.h Tue Apr 18 07:02:32 2006 +0000
1.3 @@ -420,11 +420,20 @@
1.4
1.5 /// \brief Executes one round from the bellman ford algorithm.
1.6 ///
1.7 - /// If the algoritm calculated the distances in the previous round
1.8 - /// strictly for all at most k length paths then it will calculate the
1.9 - /// distances strictly for all at most k + 1 length paths. With k
1.10 - /// iteration this function calculates the at most k length paths.
1.11 - /// \return %True when the algorithm have not found more shorter paths.
1.12 + /// If the algoritm calculated the distances in the previous round
1.13 + /// exactly for all at most \f$ k \f$ length path lengths then it will
1.14 + /// calculate the distances exactly for all at most \f$ k + 1 \f$
1.15 + /// length path lengths. With \f$ k \f$ iteration this function
1.16 + /// calculates the at most \f$ k \f$ length path lengths.
1.17 + ///
1.18 + /// \warning The paths with limited edge number cannot be retrieved
1.19 + /// easily with \ref getPath() or \ref predEdge() functions. If you
1.20 + /// need the shortest path and not just the distance you should store
1.21 + /// after each iteration the \ref predEdgeMap() map and manually build
1.22 + /// the path.
1.23 + ///
1.24 + /// \return %True when the algorithm have not found more shorter
1.25 + /// paths.
1.26 bool processNextRound() {
1.27 for (int i = 0; i < (int)_process.size(); ++i) {
1.28 _mask->set(_process[i], false);
1.29 @@ -526,13 +535,21 @@
1.30 /// \pre init() must be called and at least one node should be added
1.31 /// with addSource() before using this function.
1.32 ///
1.33 - /// This method runs the %BellmanFord algorithm from the root node(s)
1.34 - /// in order to compute the shortest path with at most \c length edge
1.35 - /// long paths to each node. The algorithm computes
1.36 - /// - The shortest path tree.
1.37 + /// This method runs the %BellmanFord algorithm from the root
1.38 + /// node(s) in order to compute the shortest path lengths with at
1.39 + /// most \c num edge.
1.40 + ///
1.41 + /// \warning The paths with limited edge number cannot be retrieved
1.42 + /// easily with \ref getPath() or \ref predEdge() functions. If you
1.43 + /// need the shortest path and not just the distance you should store
1.44 + /// after each iteration the \ref predEdgeMap() map and manually build
1.45 + /// the path.
1.46 + ///
1.47 + /// The algorithm computes
1.48 + /// - The predecessor edge from each node.
1.49 /// - The limited distance of each node from the root(s).
1.50 - void limitedStart(int length) {
1.51 - for (int i = 0; i < length; ++i) {
1.52 + void limitedStart(int num) {
1.53 + for (int i = 0; i < num; ++i) {
1.54 if (processNextRound()) break;
1.55 }
1.56 }
2.1 --- a/lemon/edmonds_karp.h Tue Apr 18 07:01:55 2006 +0000
2.2 +++ b/lemon/edmonds_karp.h Tue Apr 18 07:02:32 2006 +0000
2.3 @@ -41,10 +41,10 @@
2.4 /// edges should be passed to the algorithm through the
2.5 /// constructor.
2.6 ///
2.7 - /// The time complexity of the algorithm is O(n * e^2) in worst case.
2.8 - /// Always try the preflow algorithm instead of this if you does not
2.9 - /// have some additional reason than to compute the optimal flow which
2.10 - /// has O(n^3) time complexity.
2.11 + /// The time complexity of the algorithm is \f$ O(n * e^2) \f$ in
2.12 + /// worst case. Always try the preflow algorithm instead of this if
2.13 + /// you does not have some additional reason than to compute the
2.14 + /// optimal flow which has \f$ O(n^3) \f$ time complexity.
2.15 ///
2.16 /// \param _Graph The directed graph type the algorithm runs on.
2.17 /// \param _Number The number type of the capacities and the flow values.
2.18 @@ -53,10 +53,15 @@
2.19 /// \param _Tolerance The tolerance class to handle computation problems.
2.20 ///
2.21 /// \author Balazs Dezso
2.22 +#ifdef DOXYGEN
2.23 + template <typename _Graph, typename _Number,
2.24 + typename _CapacityMap, typename _FlowMap, typename _Tolerance>
2.25 +#else
2.26 template <typename _Graph, typename _Number,
2.27 typename _CapacityMap = typename _Graph::template EdgeMap<_Number>,
2.28 typename _FlowMap = typename _Graph::template EdgeMap<_Number>,
2.29 typename _Tolerance = Tolerance<_Number> >
2.30 +#endif
2.31 class EdmondsKarp {
2.32 public:
2.33
2.34 @@ -107,9 +112,6 @@
2.35 /// \param capacity The capacity of the edges.
2.36 /// \param flow The flow of the edges.
2.37 /// \param tolerance Tolerance class.
2.38 - /// Except the graph, all of these parameters can be reset by
2.39 - /// calling \ref source, \ref target, \ref capacityMap and \ref
2.40 - /// flowMap, resp.
2.41 EdmondsKarp(const Graph& graph, Node source, Node target,
2.42 const CapacityMap& capacity, FlowMap& flow,
2.43 const Tolerance& tolerance = Tolerance())
2.44 @@ -239,10 +241,11 @@
2.45 /// \brief runs the algorithm.
2.46 ///
2.47 /// It is just a shorthand for:
2.48 - /// \code
2.49 + ///
2.50 + ///\code
2.51 /// ek.init();
2.52 /// ek.start();
2.53 - /// \endcode
2.54 + ///\endcode
2.55 void run() {
2.56 init();
2.57 start();