# HG changeset patch # User deba # Date 1196178103 0 # Node ID 616c019215c4d60f92e6d37871da594932dabfb7 # Parent 05c0ba99cc276447efccd40ca8fca853092c9d58 Performance bug in Preflow The initial relabeling moved each node to the lowest level Doc bug fix diff -r 05c0ba99cc27 -r 616c019215c4 lemon/dinitz_sleator_tarjan.h --- a/lemon/dinitz_sleator_tarjan.h Sun Nov 25 22:56:44 2007 +0000 +++ b/lemon/dinitz_sleator_tarjan.h Tue Nov 27 15:41:43 2007 +0000 @@ -701,9 +701,10 @@ /// @} - /// \name Query Functions - /// The result of the %Dijkstra algorithm can be obtained using these - /// functions.\n + /// \name Query Functions + /// The result of the Dinitz-Sleator-Tarjan algorithm can be + /// obtained using these functions. + /// \n /// Before the use of these functions, /// either run() or start() must be called. diff -r 05c0ba99cc27 -r 616c019215c4 lemon/edmonds_karp.h --- a/lemon/edmonds_karp.h Sun Nov 25 22:56:44 2007 +0000 +++ b/lemon/edmonds_karp.h Tue Nov 27 15:41:43 2007 +0000 @@ -467,7 +467,7 @@ /// @} /// \name Query Functions - /// The result of the %Dijkstra algorithm can be obtained using these + /// The result of the Edmonds-Karp algorithm can be obtained using these /// functions.\n /// Before the use of these functions, /// either run() or start() must be called. diff -r 05c0ba99cc27 -r 616c019215c4 lemon/goldberg_tarjan.h --- a/lemon/goldberg_tarjan.h Sun Nov 25 22:56:44 2007 +0000 +++ b/lemon/goldberg_tarjan.h Tue Nov 27 15:41:43 2007 +0000 @@ -103,13 +103,13 @@ /// of the Goldberg's \ref Preflow "preflow" algorithm by using the \ref /// DynamicTree "dynamic tree" data structure of Sleator and Tarjan. /// - /// The original preflow algorithm with \e "highest label" or \e - /// FIFO heuristic has \f$O(n^3)\f$ time complexity. The current - /// algorithm improved this complexity to - /// \f$O(nm\log(\frac{n^2}{m}))\f$. The algorithm builds limited - /// size dynamic trees on the residual graph, which can be used to - /// make multilevel push operations and gives a better bound on the - /// number of non-saturating pushes. + /// The original preflow algorithm with \e highest \e label + /// heuristic has \f$O(n^2\sqrt{e})\f$ or with \e FIFO heuristic has + /// \f$O(n^3)\f$ time complexity. The current algorithm improved + /// this complexity to \f$O(nm\log(\frac{n^2}{m}))\f$. The algorithm + /// builds limited size dynamic trees on the residual graph, which + /// can be used to make multilevel push operations and gives a + /// better bound on the number of non-saturating pushes. /// /// \param Graph The directed graph type the algorithm runs on. /// \param CapacityMap The capacity map type. @@ -965,11 +965,12 @@ /// @} - /// \name Query Functions - /// The result of the %Dijkstra algorithm can be obtained using these - /// functions.\n - /// Before the use of these functions, - /// either run() or start() must be called. + /// \name Query Functions + /// The result of the Goldberg-Tarjan algorithm can be obtained + /// using these functions. + /// \n + /// Before the use of these functions, either run() or start() must + /// be called. ///@{ diff -r 05c0ba99cc27 -r 616c019215c4 lemon/preflow.h --- a/lemon/preflow.h Sun Nov 25 22:56:44 2007 +0000 +++ b/lemon/preflow.h Tue Nov 27 15:41:43 2007 +0000 @@ -72,7 +72,7 @@ /// /// \sa Elevator /// \sa LinkedElevator - typedef LinkedElevator Elevator; + typedef Elevator Elevator; /// \brief Instantiates an Elevator. /// @@ -100,7 +100,7 @@ /// directed graph. The preflow algorithms are the fastest known max /// flow algorithms. The current implementation use a mixture of the /// \e "highest label" and the \e "bound decrease" heuristics. - /// The worst case time complexity of the algorithm is \f$O(n^3)\f$. + /// The worst case time complexity of the algorithm is \f$O(n^2\sqrt{e})\f$. /// /// The algorithm consists from two phases. After the first phase /// the maximal flow value and the minimum cut can be obtained. The @@ -407,6 +407,7 @@ queue.push_back(_target); reached.set(_target, true); while (!queue.empty()) { + _level->initNewLevel(); std::vector nqueue; for (int i = 0; i < int(queue.size()); ++i) { Node n = queue[i]; @@ -863,7 +864,7 @@ /// @} /// \name Query Functions - /// The result of the %Dijkstra algorithm can be obtained using these + /// The result of the %Preflow algorithm can be obtained using these /// functions.\n /// Before the use of these functions, /// either run() or start() must be called.