0
4
0
... | ... |
@@ -382,24 +382,58 @@ |
382 | 382 |
- \ref HaoOrlin "Hao-Orlin algorithm" for calculating minimum cut |
383 | 383 |
in directed graphs. |
384 | 384 |
- \ref NagamochiIbaraki "Nagamochi-Ibaraki algorithm" for |
385 | 385 |
calculating minimum cut in undirected graphs. |
386 | 386 |
- \ref GomoryHu "Gomory-Hu tree computation" for calculating |
387 | 387 |
all-pairs minimum cut in undirected graphs. |
388 | 388 |
|
389 | 389 |
If you want to find minimum cut just between two distinict nodes, |
390 | 390 |
see the \ref max_flow "maximum flow problem". |
391 | 391 |
*/ |
392 | 392 |
|
393 | 393 |
/** |
394 |
@defgroup min_mean_cycle Minimum Mean Cycle Algorithms |
|
395 |
@ingroup algs |
|
396 |
\brief Algorithms for finding minimum mean cycles. |
|
397 |
|
|
398 |
This group contains the algorithms for finding minimum mean cycles. |
|
399 |
|
|
400 |
The \e minimum \e mean \e cycle \e problem is to find a directed cycle |
|
401 |
of minimum mean length (cost) in a digraph. |
|
402 |
The mean length of a cycle is the average length of its arcs, i.e. the |
|
403 |
ratio between the total length of the cycle and the number of arcs on it. |
|
404 |
|
|
405 |
This problem has an important connection to \e conservative \e length |
|
406 |
\e functions, too. A length function on the arcs of a digraph is called |
|
407 |
conservative if and only if there is no directed cycle of negative total |
|
408 |
length. For an arbitrary length function, the negative of the minimum |
|
409 |
cycle mean is the smallest \f$\epsilon\f$ value so that increasing the |
|
410 |
arc lengths uniformly by \f$\epsilon\f$ results in a conservative length |
|
411 |
function. |
|
412 |
|
|
413 |
LEMON contains three algorithms for solving the minimum mean cycle problem: |
|
414 |
- \ref Karp "Karp"'s original algorithm. |
|
415 |
- \ref HartmannOrlin "Hartmann-Orlin"'s algorithm, which is an improved |
|
416 |
version of Karp's algorithm. |
|
417 |
- \ref Howard "Howard"'s policy iteration algorithm. |
|
418 |
|
|
419 |
In practice, the Howard algorithm proved to be by far the most efficient |
|
420 |
one, though the best known theoretical bound on its running time is |
|
421 |
exponential. |
|
422 |
Both Karp and HartmannOrlin algorithms run in time O(ne) and use space |
|
423 |
O(n<sup>2</sup>+e), but the latter one is typically faster due to the |
|
424 |
applied early termination scheme. |
|
425 |
*/ |
|
426 |
|
|
427 |
/** |
|
394 | 428 |
@defgroup graph_properties Connectivity and Other Graph Properties |
395 | 429 |
@ingroup algs |
396 | 430 |
\brief Algorithms for discovering the graph properties |
397 | 431 |
|
398 | 432 |
This group contains the algorithms for discovering the graph properties |
399 | 433 |
like connectivity, bipartiteness, euler property, simplicity etc. |
400 | 434 |
|
401 | 435 |
\image html edge_biconnected_components.png |
402 | 436 |
\image latex edge_biconnected_components.eps "bi-edge-connected components" width=\textwidth |
403 | 437 |
*/ |
404 | 438 |
|
405 | 439 |
/** |
... | ... |
@@ -10,25 +10,25 @@ |
10 | 10 |
* provided that this copyright notice appears in all copies. For |
11 | 11 |
* precise terms see the accompanying LICENSE file. |
12 | 12 |
* |
13 | 13 |
* This software is provided "AS IS" with no warranty of any kind, |
14 | 14 |
* express or implied, and with no claim as to its suitability for any |
15 | 15 |
* purpose. |
16 | 16 |
* |
17 | 17 |
*/ |
18 | 18 |
|
19 | 19 |
#ifndef LEMON_HARTMANN_ORLIN_H |
20 | 20 |
#define LEMON_HARTMANN_ORLIN_H |
21 | 21 |
|
22 |
/// \ingroup |
|
22 |
/// \ingroup min_mean_cycle |
|
23 | 23 |
/// |
24 | 24 |
/// \file |
25 | 25 |
/// \brief Hartmann-Orlin's algorithm for finding a minimum mean cycle. |
26 | 26 |
|
27 | 27 |
#include <vector> |
28 | 28 |
#include <limits> |
29 | 29 |
#include <lemon/core.h> |
30 | 30 |
#include <lemon/path.h> |
31 | 31 |
#include <lemon/tolerance.h> |
32 | 32 |
#include <lemon/connectivity.h> |
33 | 33 |
|
34 | 34 |
namespace lemon { |
... | ... |
@@ -81,34 +81,35 @@ |
81 | 81 |
typedef LEN LengthMap; |
82 | 82 |
typedef typename LengthMap::Value Value; |
83 | 83 |
#ifdef LEMON_HAVE_LONG_LONG |
84 | 84 |
typedef long long LargeValue; |
85 | 85 |
#else |
86 | 86 |
typedef long LargeValue; |
87 | 87 |
#endif |
88 | 88 |
typedef lemon::Tolerance<LargeValue> Tolerance; |
89 | 89 |
typedef lemon::Path<Digraph> Path; |
90 | 90 |
}; |
91 | 91 |
|
92 | 92 |
|
93 |
/// \addtogroup |
|
93 |
/// \addtogroup min_mean_cycle |
|
94 | 94 |
/// @{ |
95 | 95 |
|
96 | 96 |
/// \brief Implementation of the Hartmann-Orlin algorithm for finding |
97 | 97 |
/// a minimum mean cycle. |
98 | 98 |
/// |
99 | 99 |
/// This class implements the Hartmann-Orlin algorithm for finding |
100 | 100 |
/// a directed cycle of minimum mean length (cost) in a digraph. |
101 |
/// It is an improved version of \ref Karp "Karp's original algorithm |
|
101 |
/// It is an improved version of \ref Karp "Karp"'s original algorithm, |
|
102 | 102 |
/// it applies an efficient early termination scheme. |
103 |
/// It runs in time O(ne) and uses space O(n<sup>2</sup>+e). |
|
103 | 104 |
/// |
104 | 105 |
/// \tparam GR The type of the digraph the algorithm runs on. |
105 | 106 |
/// \tparam LEN The type of the length map. The default |
106 | 107 |
/// map type is \ref concepts::Digraph::ArcMap "GR::ArcMap<int>". |
107 | 108 |
#ifdef DOXYGEN |
108 | 109 |
template <typename GR, typename LEN, typename TR> |
109 | 110 |
#else |
110 | 111 |
template < typename GR, |
111 | 112 |
typename LEN = typename GR::template ArcMap<int>, |
112 | 113 |
typename TR = HartmannOrlinDefaultTraits<GR, LEN> > |
113 | 114 |
#endif |
114 | 115 |
class HartmannOrlin |
... | ... |
@@ -10,25 +10,25 @@ |
10 | 10 |
* provided that this copyright notice appears in all copies. For |
11 | 11 |
* precise terms see the accompanying LICENSE file. |
12 | 12 |
* |
13 | 13 |
* This software is provided "AS IS" with no warranty of any kind, |
14 | 14 |
* express or implied, and with no claim as to its suitability for any |
15 | 15 |
* purpose. |
16 | 16 |
* |
17 | 17 |
*/ |
18 | 18 |
|
19 | 19 |
#ifndef LEMON_HOWARD_H |
20 | 20 |
#define LEMON_HOWARD_H |
21 | 21 |
|
22 |
/// \ingroup |
|
22 |
/// \ingroup min_mean_cycle |
|
23 | 23 |
/// |
24 | 24 |
/// \file |
25 | 25 |
/// \brief Howard's algorithm for finding a minimum mean cycle. |
26 | 26 |
|
27 | 27 |
#include <vector> |
28 | 28 |
#include <limits> |
29 | 29 |
#include <lemon/core.h> |
30 | 30 |
#include <lemon/path.h> |
31 | 31 |
#include <lemon/tolerance.h> |
32 | 32 |
#include <lemon/connectivity.h> |
33 | 33 |
|
34 | 34 |
namespace lemon { |
... | ... |
@@ -81,32 +81,35 @@ |
81 | 81 |
typedef LEN LengthMap; |
82 | 82 |
typedef typename LengthMap::Value Value; |
83 | 83 |
#ifdef LEMON_HAVE_LONG_LONG |
84 | 84 |
typedef long long LargeValue; |
85 | 85 |
#else |
86 | 86 |
typedef long LargeValue; |
87 | 87 |
#endif |
88 | 88 |
typedef lemon::Tolerance<LargeValue> Tolerance; |
89 | 89 |
typedef lemon::Path<Digraph> Path; |
90 | 90 |
}; |
91 | 91 |
|
92 | 92 |
|
93 |
/// \addtogroup |
|
93 |
/// \addtogroup min_mean_cycle |
|
94 | 94 |
/// @{ |
95 | 95 |
|
96 | 96 |
/// \brief Implementation of Howard's algorithm for finding a minimum |
97 | 97 |
/// mean cycle. |
98 | 98 |
/// |
99 | 99 |
/// This class implements Howard's policy iteration algorithm for finding |
100 | 100 |
/// a directed cycle of minimum mean length (cost) in a digraph. |
101 |
/// This class provides the most efficient algorithm for the |
|
102 |
/// minimum mean cycle problem, though the best known theoretical |
|
103 |
/// bound on its running time is exponential. |
|
101 | 104 |
/// |
102 | 105 |
/// \tparam GR The type of the digraph the algorithm runs on. |
103 | 106 |
/// \tparam LEN The type of the length map. The default |
104 | 107 |
/// map type is \ref concepts::Digraph::ArcMap "GR::ArcMap<int>". |
105 | 108 |
#ifdef DOXYGEN |
106 | 109 |
template <typename GR, typename LEN, typename TR> |
107 | 110 |
#else |
108 | 111 |
template < typename GR, |
109 | 112 |
typename LEN = typename GR::template ArcMap<int>, |
110 | 113 |
typename TR = HowardDefaultTraits<GR, LEN> > |
111 | 114 |
#endif |
112 | 115 |
class Howard |
... | ... |
@@ -10,25 +10,25 @@ |
10 | 10 |
* provided that this copyright notice appears in all copies. For |
11 | 11 |
* precise terms see the accompanying LICENSE file. |
12 | 12 |
* |
13 | 13 |
* This software is provided "AS IS" with no warranty of any kind, |
14 | 14 |
* express or implied, and with no claim as to its suitability for any |
15 | 15 |
* purpose. |
16 | 16 |
* |
17 | 17 |
*/ |
18 | 18 |
|
19 | 19 |
#ifndef LEMON_KARP_H |
20 | 20 |
#define LEMON_KARP_H |
21 | 21 |
|
22 |
/// \ingroup |
|
22 |
/// \ingroup min_mean_cycle |
|
23 | 23 |
/// |
24 | 24 |
/// \file |
25 | 25 |
/// \brief Karp's algorithm for finding a minimum mean cycle. |
26 | 26 |
|
27 | 27 |
#include <vector> |
28 | 28 |
#include <limits> |
29 | 29 |
#include <lemon/core.h> |
30 | 30 |
#include <lemon/path.h> |
31 | 31 |
#include <lemon/tolerance.h> |
32 | 32 |
#include <lemon/connectivity.h> |
33 | 33 |
|
34 | 34 |
namespace lemon { |
... | ... |
@@ -81,32 +81,33 @@ |
81 | 81 |
typedef LEN LengthMap; |
82 | 82 |
typedef typename LengthMap::Value Value; |
83 | 83 |
#ifdef LEMON_HAVE_LONG_LONG |
84 | 84 |
typedef long long LargeValue; |
85 | 85 |
#else |
86 | 86 |
typedef long LargeValue; |
87 | 87 |
#endif |
88 | 88 |
typedef lemon::Tolerance<LargeValue> Tolerance; |
89 | 89 |
typedef lemon::Path<Digraph> Path; |
90 | 90 |
}; |
91 | 91 |
|
92 | 92 |
|
93 |
/// \addtogroup |
|
93 |
/// \addtogroup min_mean_cycle |
|
94 | 94 |
/// @{ |
95 | 95 |
|
96 | 96 |
/// \brief Implementation of Karp's algorithm for finding a minimum |
97 | 97 |
/// mean cycle. |
98 | 98 |
/// |
99 | 99 |
/// This class implements Karp's algorithm for finding a directed |
100 | 100 |
/// cycle of minimum mean length (cost) in a digraph. |
101 |
/// It runs in time O(ne) and uses space O(n<sup>2</sup>+e). |
|
101 | 102 |
/// |
102 | 103 |
/// \tparam GR The type of the digraph the algorithm runs on. |
103 | 104 |
/// \tparam LEN The type of the length map. The default |
104 | 105 |
/// map type is \ref concepts::Digraph::ArcMap "GR::ArcMap<int>". |
105 | 106 |
#ifdef DOXYGEN |
106 | 107 |
template <typename GR, typename LEN, typename TR> |
107 | 108 |
#else |
108 | 109 |
template < typename GR, |
109 | 110 |
typename LEN = typename GR::template ArcMap<int>, |
110 | 111 |
typename TR = KarpDefaultTraits<GR, LEN> > |
111 | 112 |
#endif |
112 | 113 |
class Karp |
0 comments (0 inline)