gravatar
kpeter (Peter Kovacs)
kpeter@inf.elte.hu
Minor doc improvements
0 5 0
default
5 files changed with 8 insertions and 7 deletions:
↑ Collapse diff ↑
Ignore white space 6 line context
... ...
@@ -65,49 +65,50 @@
65 65
  /// finding a \ref min_cost_flow "minimum cost flow".
66 66
  ///
67 67
  /// \ref CapacityScaling implements the capacity scaling version
68 68
  /// of the successive shortest path algorithm for finding a
69 69
  /// \ref min_cost_flow "minimum cost flow" \ref amo93networkflows,
70 70
  /// \ref edmondskarp72theoretical. It is an efficient dual
71 71
  /// solution method.
72 72
  ///
73 73
  /// Most of the parameters of the problem (except for the digraph)
74 74
  /// can be given using separate functions, and the algorithm can be
75 75
  /// executed using the \ref run() function. If some parameters are not
76 76
  /// specified, then default values will be used.
77 77
  ///
78 78
  /// \tparam GR The digraph type the algorithm runs on.
79 79
  /// \tparam V The number type used for flow amounts, capacity bounds
80 80
  /// and supply values in the algorithm. By default, it is \c int.
81 81
  /// \tparam C The number type used for costs and potentials in the
82 82
  /// algorithm. By default, it is the same as \c V.
83 83
  /// \tparam TR The traits class that defines various types used by the
84 84
  /// algorithm. By default, it is \ref CapacityScalingDefaultTraits
85 85
  /// "CapacityScalingDefaultTraits<GR, V, C>".
86 86
  /// In most cases, this parameter should not be set directly,
87 87
  /// consider to use the named template parameters instead.
88 88
  ///
89
  /// \warning Both number types must be signed and all input data must
89
  /// \warning Both \c V and \c C must be signed number types.
90
  /// \warning All input data (capacities, supply values, and costs) must
90 91
  /// be integer.
91 92
  /// \warning This algorithm does not support negative costs for such
92 93
  /// arcs that have infinite upper bound.
93 94
#ifdef DOXYGEN
94 95
  template <typename GR, typename V, typename C, typename TR>
95 96
#else
96 97
  template < typename GR, typename V = int, typename C = V,
97 98
             typename TR = CapacityScalingDefaultTraits<GR, V, C> >
98 99
#endif
99 100
  class CapacityScaling
100 101
  {
101 102
  public:
102 103

	
103 104
    /// The type of the digraph
104 105
    typedef typename TR::Digraph Digraph;
105 106
    /// The type of the flow amounts, capacity bounds and supply values
106 107
    typedef typename TR::Value Value;
107 108
    /// The type of the arc costs
108 109
    typedef typename TR::Cost Cost;
109 110

	
110 111
    /// The type of the heap used for internal Dijkstra computations
111 112
    typedef typename TR::Heap Heap;
112 113

	
113 114
    /// The \ref CapacityScalingDefaultTraits "traits class" of the algorithm
Ignore white space 48 line context
... ...
@@ -92,49 +92,50 @@
92 92
  /// \ref CostScaling implements a cost scaling algorithm that performs
93 93
  /// push/augment and relabel operations for finding a \ref min_cost_flow
94 94
  /// "minimum cost flow" \ref amo93networkflows, \ref goldberg90approximation,
95 95
  /// \ref goldberg97efficient, \ref bunnagel98efficient.
96 96
  /// It is a highly efficient primal-dual solution method, which
97 97
  /// can be viewed as the generalization of the \ref Preflow
98 98
  /// "preflow push-relabel" algorithm for the maximum flow problem.
99 99
  ///
100 100
  /// Most of the parameters of the problem (except for the digraph)
101 101
  /// can be given using separate functions, and the algorithm can be
102 102
  /// executed using the \ref run() function. If some parameters are not
103 103
  /// specified, then default values will be used.
104 104
  ///
105 105
  /// \tparam GR The digraph type the algorithm runs on.
106 106
  /// \tparam V The number type used for flow amounts, capacity bounds
107 107
  /// and supply values in the algorithm. By default, it is \c int.
108 108
  /// \tparam C The number type used for costs and potentials in the
109 109
  /// algorithm. By default, it is the same as \c V.
110 110
  /// \tparam TR The traits class that defines various types used by the
111 111
  /// algorithm. By default, it is \ref CostScalingDefaultTraits
112 112
  /// "CostScalingDefaultTraits<GR, V, C>".
113 113
  /// In most cases, this parameter should not be set directly,
114 114
  /// consider to use the named template parameters instead.
115 115
  ///
116
  /// \warning Both number types must be signed and all input data must
116
  /// \warning Both \c V and \c C must be signed number types.
117
  /// \warning All input data (capacities, supply values, and costs) must
117 118
  /// be integer.
118 119
  /// \warning This algorithm does not support negative costs for such
119 120
  /// arcs that have infinite upper bound.
120 121
  ///
121 122
  /// \note %CostScaling provides three different internal methods,
122 123
  /// from which the most efficient one is used by default.
123 124
  /// For more information, see \ref Method.
124 125
#ifdef DOXYGEN
125 126
  template <typename GR, typename V, typename C, typename TR>
126 127
#else
127 128
  template < typename GR, typename V = int, typename C = V,
128 129
             typename TR = CostScalingDefaultTraits<GR, V, C> >
129 130
#endif
130 131
  class CostScaling
131 132
  {
132 133
  public:
133 134

	
134 135
    /// The type of the digraph
135 136
    typedef typename TR::Digraph Digraph;
136 137
    /// The type of the flow amounts, capacity bounds and supply values
137 138
    typedef typename TR::Value Value;
138 139
    /// The type of the arc costs
139 140
    typedef typename TR::Cost Cost;
140 141

	
Ignore white space 6 line context
... ...
@@ -44,49 +44,50 @@
44 44
  /// \brief Implementation of cycle-canceling algorithms for
45 45
  /// finding a \ref min_cost_flow "minimum cost flow".
46 46
  ///
47 47
  /// \ref CycleCanceling implements three different cycle-canceling
48 48
  /// algorithms for finding a \ref min_cost_flow "minimum cost flow"
49 49
  /// \ref amo93networkflows, \ref klein67primal,
50 50
  /// \ref goldberg89cyclecanceling.
51 51
  /// The most efficent one (both theoretically and practically)
52 52
  /// is the \ref CANCEL_AND_TIGHTEN "Cancel and Tighten" algorithm,
53 53
  /// thus it is the default method.
54 54
  /// It is strongly polynomial, but in practice, it is typically much
55 55
  /// slower than the scaling algorithms and NetworkSimplex.
56 56
  ///
57 57
  /// Most of the parameters of the problem (except for the digraph)
58 58
  /// can be given using separate functions, and the algorithm can be
59 59
  /// executed using the \ref run() function. If some parameters are not
60 60
  /// specified, then default values will be used.
61 61
  ///
62 62
  /// \tparam GR The digraph type the algorithm runs on.
63 63
  /// \tparam V The number type used for flow amounts, capacity bounds
64 64
  /// and supply values in the algorithm. By default, it is \c int.
65 65
  /// \tparam C The number type used for costs and potentials in the
66 66
  /// algorithm. By default, it is the same as \c V.
67 67
  ///
68
  /// \warning Both number types must be signed and all input data must
68
  /// \warning Both \c V and \c C must be signed number types.
69
  /// \warning All input data (capacities, supply values, and costs) must
69 70
  /// be integer.
70 71
  /// \warning This algorithm does not support negative costs for such
71 72
  /// arcs that have infinite upper bound.
72 73
  ///
73 74
  /// \note For more information about the three available methods,
74 75
  /// see \ref Method.
75 76
#ifdef DOXYGEN
76 77
  template <typename GR, typename V, typename C>
77 78
#else
78 79
  template <typename GR, typename V = int, typename C = V>
79 80
#endif
80 81
  class CycleCanceling
81 82
  {
82 83
  public:
83 84

	
84 85
    /// The type of the digraph
85 86
    typedef GR Digraph;
86 87
    /// The type of the flow amounts, capacity bounds and supply values
87 88
    typedef V Value;
88 89
    /// The type of the arc costs
89 90
    typedef C Cost;
90 91

	
91 92
  public:
92 93

	
Ignore white space 6 line context
... ...
@@ -9,51 +9,48 @@
9 9
 * Permission to use, modify and distribute this software is granted
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_KRUSKAL_H
20 20
#define LEMON_KRUSKAL_H
21 21

	
22 22
#include <algorithm>
23 23
#include <vector>
24 24
#include <lemon/unionfind.h>
25 25
#include <lemon/maps.h>
26 26

	
27 27
#include <lemon/core.h>
28 28
#include <lemon/bits/traits.h>
29 29

	
30 30
///\ingroup spantree
31 31
///\file
32 32
///\brief Kruskal's algorithm to compute a minimum cost spanning tree
33
///
34
///Kruskal's algorithm to compute a minimum cost spanning tree.
35
///
36 33

	
37 34
namespace lemon {
38 35

	
39 36
  namespace _kruskal_bits {
40 37

	
41 38
    // Kruskal for directed graphs.
42 39

	
43 40
    template <typename Digraph, typename In, typename Out>
44 41
    typename disable_if<lemon::UndirectedTagIndicator<Digraph>,
45 42
                       typename In::value_type::second_type >::type
46 43
    kruskal(const Digraph& digraph, const In& in, Out& out,dummy<0> = 0) {
47 44
      typedef typename In::value_type::second_type Value;
48 45
      typedef typename Digraph::template NodeMap<int> IndexMap;
49 46
      typedef typename Digraph::Node Node;
50 47

	
51 48
      IndexMap index(digraph);
52 49
      UnionFind<IndexMap> uf(index);
53 50
      for (typename Digraph::NodeIt it(digraph); it != INVALID; ++it) {
54 51
        uf.insert(it);
55 52
      }
56 53

	
57 54
      Value tree_value = 0;
58 55
      for (typename In::const_iterator it = in.begin(); it != in.end(); ++it) {
59 56
        if (uf.join(digraph.target(it->first),digraph.source(it->first))) {
Ignore white space 6 line context
... ...
@@ -42,49 +42,50 @@
42 42
  /// \ref NetworkSimplex implements the primal Network Simplex algorithm
43 43
  /// for finding a \ref min_cost_flow "minimum cost flow"
44 44
  /// \ref amo93networkflows, \ref dantzig63linearprog,
45 45
  /// \ref kellyoneill91netsimplex.
46 46
  /// This algorithm is a highly efficient specialized version of the
47 47
  /// linear programming simplex method directly for the minimum cost
48 48
  /// flow problem.
49 49
  ///
50 50
  /// In general, %NetworkSimplex is the fastest implementation available
51 51
  /// in LEMON for this problem.
52 52
  /// Moreover, it supports both directions of the supply/demand inequality
53 53
  /// constraints. For more information, see \ref SupplyType.
54 54
  ///
55 55
  /// Most of the parameters of the problem (except for the digraph)
56 56
  /// can be given using separate functions, and the algorithm can be
57 57
  /// executed using the \ref run() function. If some parameters are not
58 58
  /// specified, then default values will be used.
59 59
  ///
60 60
  /// \tparam GR The digraph type the algorithm runs on.
61 61
  /// \tparam V The number type used for flow amounts, capacity bounds
62 62
  /// and supply values in the algorithm. By default, it is \c int.
63 63
  /// \tparam C The number type used for costs and potentials in the
64 64
  /// algorithm. By default, it is the same as \c V.
65 65
  ///
66
  /// \warning Both number types must be signed and all input data must
66
  /// \warning Both \c V and \c C must be signed number types.
67
  /// \warning All input data (capacities, supply values, and costs) must
67 68
  /// be integer.
68 69
  ///
69 70
  /// \note %NetworkSimplex provides five different pivot rule
70 71
  /// implementations, from which the most efficient one is used
71 72
  /// by default. For more information, see \ref PivotRule.
72 73
  template <typename GR, typename V = int, typename C = V>
73 74
  class NetworkSimplex
74 75
  {
75 76
  public:
76 77

	
77 78
    /// The type of the flow amounts, capacity bounds and supply values
78 79
    typedef V Value;
79 80
    /// The type of the arc costs
80 81
    typedef C Cost;
81 82

	
82 83
  public:
83 84

	
84 85
    /// \brief Problem type constants for the \c run() function.
85 86
    ///
86 87
    /// Enum type containing the problem type constants that can be
87 88
    /// returned by the \ref run() function of the algorithm.
88 89
    enum ProblemType {
89 90
      /// The problem has no feasible solution (flow).
90 91
      INFEASIBLE,
0 comments (0 inline)