0
4
0
... | ... |
@@ -436,68 +436,71 @@ |
436 | 436 |
\f$cap: A\rightarrow\mathbf{R}^+_0\f$ capacity function. The minimum |
437 | 437 |
cut is the \f$X\f$ solution of the next optimization problem: |
438 | 438 |
|
439 | 439 |
\f[ \min_{X \subset V, X\not\in \{\emptyset, V\}} |
440 | 440 |
\sum_{uv\in A: u\in X, v\not\in X}cap(uv) \f] |
441 | 441 |
|
442 | 442 |
LEMON contains several algorithms related to minimum cut problems: |
443 | 443 |
|
444 | 444 |
- \ref HaoOrlin "Hao-Orlin algorithm" for calculating minimum cut |
445 | 445 |
in directed graphs. |
446 | 446 |
- \ref NagamochiIbaraki "Nagamochi-Ibaraki algorithm" for |
447 | 447 |
calculating minimum cut in undirected graphs. |
448 | 448 |
- \ref GomoryHu "Gomory-Hu tree computation" for calculating |
449 | 449 |
all-pairs minimum cut in undirected graphs. |
450 | 450 |
|
451 | 451 |
If you want to find minimum cut just between two distinict nodes, |
452 | 452 |
see the \ref max_flow "maximum flow problem". |
453 | 453 |
*/ |
454 | 454 |
|
455 | 455 |
/** |
456 | 456 |
@defgroup min_mean_cycle Minimum Mean Cycle Algorithms |
457 | 457 |
@ingroup algs |
458 | 458 |
\brief Algorithms for finding minimum mean cycles. |
459 | 459 |
|
460 |
This group contains the algorithms for finding minimum mean cycles |
|
460 |
This group contains the algorithms for finding minimum mean cycles |
|
461 |
\ref clrs01algorithms, \ref amo93networkflows. |
|
461 | 462 |
|
462 | 463 |
The \e minimum \e mean \e cycle \e problem is to find a directed cycle |
463 | 464 |
of minimum mean length (cost) in a digraph. |
464 | 465 |
The mean length of a cycle is the average length of its arcs, i.e. the |
465 | 466 |
ratio between the total length of the cycle and the number of arcs on it. |
466 | 467 |
|
467 | 468 |
This problem has an important connection to \e conservative \e length |
468 | 469 |
\e functions, too. A length function on the arcs of a digraph is called |
469 | 470 |
conservative if and only if there is no directed cycle of negative total |
470 | 471 |
length. For an arbitrary length function, the negative of the minimum |
471 | 472 |
cycle mean is the smallest \f$\epsilon\f$ value so that increasing the |
472 | 473 |
arc lengths uniformly by \f$\epsilon\f$ results in a conservative length |
473 | 474 |
function. |
474 | 475 |
|
475 | 476 |
LEMON contains three algorithms for solving the minimum mean cycle problem: |
476 |
- \ref Karp "Karp"'s original algorithm |
|
477 |
- \ref Karp "Karp"'s original algorithm \ref amo93networkflows, |
|
478 |
\ref dasdan98minmeancycle. |
|
477 | 479 |
- \ref HartmannOrlin "Hartmann-Orlin"'s algorithm, which is an improved |
478 |
version of Karp's algorithm. |
|
479 |
- \ref Howard "Howard"'s policy iteration algorithm. |
|
480 |
version of Karp's algorithm \ref dasdan98minmeancycle. |
|
481 |
- \ref Howard "Howard"'s policy iteration algorithm |
|
482 |
\ref dasdan98minmeancycle. |
|
480 | 483 |
|
481 | 484 |
In practice, the Howard algorithm proved to be by far the most efficient |
482 | 485 |
one, though the best known theoretical bound on its running time is |
483 | 486 |
exponential. |
484 | 487 |
Both Karp and HartmannOrlin algorithms run in time O(ne) and use space |
485 | 488 |
O(n<sup>2</sup>+e), but the latter one is typically faster due to the |
486 | 489 |
applied early termination scheme. |
487 | 490 |
*/ |
488 | 491 |
|
489 | 492 |
/** |
490 | 493 |
@defgroup matching Matching Algorithms |
491 | 494 |
@ingroup algs |
492 | 495 |
\brief Algorithms for finding matchings in graphs and bipartite graphs. |
493 | 496 |
|
494 | 497 |
This group contains the algorithms for calculating |
495 | 498 |
matchings in graphs and bipartite graphs. The general matching problem is |
496 | 499 |
finding a subset of the edges for which each node has at most one incident |
497 | 500 |
edge. |
498 | 501 |
|
499 | 502 |
There are several different algorithms for calculate matchings in |
500 | 503 |
graphs. The matching problems in bipartite graphs are generally |
501 | 504 |
easier than in general graphs. The goal of the matching optimization |
502 | 505 |
can be finding maximum cardinality, maximum weight or minimum cost |
503 | 506 |
matching. The search can be constrained to find perfect or |
... | ... |
@@ -76,49 +76,50 @@ |
76 | 76 |
// Default traits class for integer value types |
77 | 77 |
template <typename GR, typename LEN> |
78 | 78 |
struct HartmannOrlinDefaultTraits<GR, LEN, true> |
79 | 79 |
{ |
80 | 80 |
typedef GR Digraph; |
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 | 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 |
/// a directed cycle of minimum mean length (cost) in a digraph |
|
100 |
/// a directed cycle of minimum mean length (cost) in a digraph |
|
101 |
/// \ref amo93networkflows, \ref dasdan98minmeancycle. |
|
101 | 102 |
/// It is an improved version of \ref Karp "Karp"'s original algorithm, |
102 | 103 |
/// it applies an efficient early termination scheme. |
103 | 104 |
/// It runs in time O(ne) and uses space O(n<sup>2</sup>+e). |
104 | 105 |
/// |
105 | 106 |
/// \tparam GR The type of the digraph the algorithm runs on. |
106 | 107 |
/// \tparam LEN The type of the length map. The default |
107 | 108 |
/// map type is \ref concepts::Digraph::ArcMap "GR::ArcMap<int>". |
108 | 109 |
#ifdef DOXYGEN |
109 | 110 |
template <typename GR, typename LEN, typename TR> |
110 | 111 |
#else |
111 | 112 |
template < typename GR, |
112 | 113 |
typename LEN = typename GR::template ArcMap<int>, |
113 | 114 |
typename TR = HartmannOrlinDefaultTraits<GR, LEN> > |
114 | 115 |
#endif |
115 | 116 |
class HartmannOrlin |
116 | 117 |
{ |
117 | 118 |
public: |
118 | 119 |
|
119 | 120 |
/// The type of the digraph |
120 | 121 |
typedef typename TR::Digraph Digraph; |
121 | 122 |
/// The type of the length map |
122 | 123 |
typedef typename TR::LengthMap LengthMap; |
123 | 124 |
/// The type of the arc lengths |
124 | 125 |
typedef typename TR::Value Value; |
... | ... |
@@ -76,49 +76,50 @@ |
76 | 76 |
// Default traits class for integer value types |
77 | 77 |
template <typename GR, typename LEN> |
78 | 78 |
struct HowardDefaultTraits<GR, LEN, true> |
79 | 79 |
{ |
80 | 80 |
typedef GR Digraph; |
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 | 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 |
/// a directed cycle of minimum mean length (cost) in a digraph |
|
100 |
/// a directed cycle of minimum mean length (cost) in a digraph |
|
101 |
/// \ref amo93networkflows, \ref dasdan98minmeancycle. |
|
101 | 102 |
/// This class provides the most efficient algorithm for the |
102 | 103 |
/// minimum mean cycle problem, though the best known theoretical |
103 | 104 |
/// bound on its running time is exponential. |
104 | 105 |
/// |
105 | 106 |
/// \tparam GR The type of the digraph the algorithm runs on. |
106 | 107 |
/// \tparam LEN The type of the length map. The default |
107 | 108 |
/// map type is \ref concepts::Digraph::ArcMap "GR::ArcMap<int>". |
108 | 109 |
#ifdef DOXYGEN |
109 | 110 |
template <typename GR, typename LEN, typename TR> |
110 | 111 |
#else |
111 | 112 |
template < typename GR, |
112 | 113 |
typename LEN = typename GR::template ArcMap<int>, |
113 | 114 |
typename TR = HowardDefaultTraits<GR, LEN> > |
114 | 115 |
#endif |
115 | 116 |
class Howard |
116 | 117 |
{ |
117 | 118 |
public: |
118 | 119 |
|
119 | 120 |
/// The type of the digraph |
120 | 121 |
typedef typename TR::Digraph Digraph; |
121 | 122 |
/// The type of the length map |
122 | 123 |
typedef typename TR::LengthMap LengthMap; |
123 | 124 |
/// The type of the arc lengths |
124 | 125 |
typedef typename TR::Value Value; |
... | ... |
@@ -76,49 +76,50 @@ |
76 | 76 |
// Default traits class for integer value types |
77 | 77 |
template <typename GR, typename LEN> |
78 | 78 |
struct KarpDefaultTraits<GR, LEN, true> |
79 | 79 |
{ |
80 | 80 |
typedef GR Digraph; |
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 | 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 |
/// cycle of minimum mean length (cost) in a digraph |
|
100 |
/// cycle of minimum mean length (cost) in a digraph |
|
101 |
/// \ref amo93networkflows, \ref dasdan98minmeancycle. |
|
101 | 102 |
/// It runs in time O(ne) and uses space O(n<sup>2</sup>+e). |
102 | 103 |
/// |
103 | 104 |
/// \tparam GR The type of the digraph the algorithm runs on. |
104 | 105 |
/// \tparam LEN The type of the length map. The default |
105 | 106 |
/// map type is \ref concepts::Digraph::ArcMap "GR::ArcMap<int>". |
106 | 107 |
#ifdef DOXYGEN |
107 | 108 |
template <typename GR, typename LEN, typename TR> |
108 | 109 |
#else |
109 | 110 |
template < typename GR, |
110 | 111 |
typename LEN = typename GR::template ArcMap<int>, |
111 | 112 |
typename TR = KarpDefaultTraits<GR, LEN> > |
112 | 113 |
#endif |
113 | 114 |
class Karp |
114 | 115 |
{ |
115 | 116 |
public: |
116 | 117 |
|
117 | 118 |
/// The type of the digraph |
118 | 119 |
typedef typename TR::Digraph Digraph; |
119 | 120 |
/// The type of the length map |
120 | 121 |
typedef typename TR::LengthMap LengthMap; |
121 | 122 |
/// The type of the arc lengths |
122 | 123 |
typedef typename TR::Value Value; |
123 | 124 |
|
124 | 125 |
/// \brief The large value type |
0 comments (0 inline)