3
2
3
21
21
13
12
12
12
... | ... |
@@ -62,3 +62,3 @@ |
62 | 62 |
lemon/bin_heap.h \ |
63 |
lemon/ |
|
63 |
lemon/binomial_heap.h \ |
|
64 | 64 |
lemon/bucket_heap.h \ |
... | ... |
@@ -77,2 +77,3 @@ |
77 | 77 |
lemon/dfs.h \ |
78 |
lemon/dheap.h \ |
|
78 | 79 |
lemon/dijkstra.h \ |
... | ... |
@@ -85,3 +86,2 @@ |
85 | 86 |
lemon/fib_heap.h \ |
86 |
lemon/fourary_heap.h \ |
|
87 | 87 |
lemon/full_graph.h \ |
... | ... |
@@ -95,3 +95,2 @@ |
95 | 95 |
lemon/karp.h \ |
96 |
lemon/kary_heap.h \ |
|
97 | 96 |
lemon/kruskal.h \ |
... | ... |
@@ -114,2 +113,3 @@ |
114 | 113 |
lemon/preflow.h \ |
114 |
lemon/quad_heap.h \ |
|
115 | 115 |
lemon/radix_heap.h \ |
... | ... |
@@ -18,4 +18,4 @@ |
18 | 18 |
|
19 |
#ifndef LEMON_BINOM_HEAP_H |
|
20 |
#define LEMON_BINOM_HEAP_H |
|
19 |
#ifndef LEMON_BINOMIAL_HEAP_H |
|
20 |
#define LEMON_BINOMIAL_HEAP_H |
|
21 | 21 |
|
... | ... |
@@ -55,3 +55,3 @@ |
55 | 55 |
#endif |
56 |
class |
|
56 |
class BinomialHeap { |
|
57 | 57 |
public: |
... | ... |
@@ -96,3 +96,3 @@ |
96 | 96 |
/// The assigned value must be \c PRE_HEAP (<tt>-1</tt>) for each item. |
97 |
explicit |
|
97 |
explicit BinomialHeap(ItemIntMap &map) |
|
98 | 98 |
: _min(0), _head(-1), _iim(map), _num_items(0) {} |
... | ... |
@@ -106,3 +106,3 @@ |
106 | 106 |
/// \param comp The function object used for comparing the priorities. |
107 |
|
|
107 |
BinomialHeap(ItemIntMap &map, const Compare &comp) |
|
108 | 108 |
: _min(0), _head(-1), _iim(map), _comp(comp), _num_items(0) {} |
... | ... |
@@ -426,3 +426,3 @@ |
426 | 426 |
class Store { |
427 |
friend class |
|
427 |
friend class BinomialHeap; |
|
428 | 428 |
|
... | ... |
@@ -443,3 +443,3 @@ |
443 | 443 |
|
444 |
#endif // |
|
444 |
#endif //LEMON_BINOMIAL_HEAP_H |
|
445 | 445 |
... | ... |
@@ -18,4 +18,4 @@ |
18 | 18 |
|
19 |
#ifndef LEMON_KARY_HEAP_H |
|
20 |
#define LEMON_KARY_HEAP_H |
|
19 |
#ifndef LEMON_DHEAP_H |
|
20 |
#define LEMON_DHEAP_H |
|
21 | 21 |
|
... | ... |
@@ -23,3 +23,3 @@ |
23 | 23 |
///\file |
24 |
///\brief |
|
24 |
///\brief D-ary heap implementation. |
|
25 | 25 |
|
... | ... |
@@ -33,12 +33,12 @@ |
33 | 33 |
/// |
34 |
///\brief |
|
34 |
///\brief D-ary heap data structure. |
|
35 | 35 |
/// |
36 |
/// This class implements the \e |
|
36 |
/// This class implements the \e D-ary \e heap data structure. |
|
37 | 37 |
/// It fully conforms to the \ref concepts::Heap "heap concept". |
38 | 38 |
/// |
39 |
/// The \ref |
|
39 |
/// The \ref DHeap "D-ary heap" is a generalization of the |
|
40 | 40 |
/// \ref BinHeap "binary heap" structure, its nodes have at most |
41 |
/// \c K children, instead of two. |
|
42 |
/// \ref BinHeap and \ref FouraryHeap are specialized implementations |
|
43 |
/// |
|
41 |
/// \c D children, instead of two. |
|
42 |
/// \ref BinHeap and \ref QuadHeap are specialized implementations |
|
43 |
/// of this structure for <tt>D=2</tt> and <tt>D=4</tt>, respectively. |
|
44 | 44 |
/// |
... | ... |
@@ -47,3 +47,3 @@ |
47 | 47 |
/// internally to handle the cross references. |
48 |
/// \tparam |
|
48 |
/// \tparam D The degree of the heap, each node have at most \e D |
|
49 | 49 |
/// children. The default is 16. Powers of two are suggested to use |
... | ... |
@@ -57,8 +57,8 @@ |
57 | 57 |
#ifdef DOXYGEN |
58 |
template <typename PR, typename IM, int |
|
58 |
template <typename PR, typename IM, int D, typename CMP> |
|
59 | 59 |
#else |
60 |
template <typename PR, typename IM, int |
|
60 |
template <typename PR, typename IM, int D = 16, |
|
61 | 61 |
typename CMP = std::less<PR> > |
62 | 62 |
#endif |
63 |
class |
|
63 |
class DHeap { |
|
64 | 64 |
public: |
... | ... |
@@ -101,3 +101,3 @@ |
101 | 101 |
/// The assigned value must be \c PRE_HEAP (<tt>-1</tt>) for each item. |
102 |
explicit |
|
102 |
explicit DHeap(ItemIntMap &map) : _iim(map) {} |
|
103 | 103 |
|
... | ... |
@@ -110,3 +110,3 @@ |
110 | 110 |
/// \param comp The function object used for comparing the priorities. |
111 |
|
|
111 |
DHeap(ItemIntMap &map, const Compare &comp) |
|
112 | 112 |
: _iim(map), _comp(comp) {} |
... | ... |
@@ -133,4 +133,4 @@ |
133 | 133 |
private: |
134 |
int parent(int i) { return (i-1)/K; } |
|
135 |
int firstChild(int i) { return K*i+1; } |
|
134 |
int parent(int i) { return (i-1)/D; } |
|
135 |
int firstChild(int i) { return D*i+1; } |
|
136 | 136 |
|
... | ... |
@@ -153,5 +153,5 @@ |
153 | 153 |
int child = firstChild(hole); |
154 |
while( child+ |
|
154 |
while( child+D<=length ) { |
|
155 | 155 |
int min=child; |
156 |
for (int i=1; i< |
|
156 |
for (int i=1; i<D; ++i) { |
|
157 | 157 |
if( less(_data[child+i], _data[min]) ) |
... | ... |
@@ -347,3 +347,3 @@ |
347 | 347 |
|
348 |
}; // class |
|
348 |
}; // class DHeap |
|
349 | 349 |
|
... | ... |
@@ -351,2 +351,2 @@ |
351 | 351 |
|
352 |
#endif // |
|
352 |
#endif // LEMON_DHEAP_H |
... | ... |
@@ -18,4 +18,4 @@ |
18 | 18 |
|
19 |
#ifndef LEMON_FOURARY_HEAP_H |
|
20 |
#define LEMON_FOURARY_HEAP_H |
|
19 |
#ifndef LEMON_QUAD_HEAP_H |
|
20 |
#define LEMON_QUAD_HEAP_H |
|
21 | 21 |
|
... | ... |
@@ -23,3 +23,3 @@ |
23 | 23 |
///\file |
24 |
///\brief Fourary heap implementation. |
|
24 |
///\brief Fourary (quaternary) heap implementation. |
|
25 | 25 |
|
... | ... |
@@ -33,9 +33,10 @@ |
33 | 33 |
/// |
34 |
///\brief Fourary heap data structure. |
|
34 |
///\brief Fourary (quaternary) heap data structure. |
|
35 | 35 |
/// |
36 |
/// This class implements the \e |
|
36 |
/// This class implements the \e Fourary (\e quaternary) \e heap |
|
37 |
/// data structure. |
|
37 | 38 |
/// It fully conforms to the \ref concepts::Heap "heap concept". |
38 | 39 |
/// |
39 |
/// The fourary heap is a specialization of the \ref KaryHeap "K-ary heap" |
|
40 |
/// for <tt>K=4</tt>. It is similar to the \ref BinHeap "binary heap", |
|
40 |
/// The fourary heap is a specialization of the \ref DHeap "D-ary heap" |
|
41 |
/// for <tt>D=4</tt>. It is similar to the \ref BinHeap "binary heap", |
|
41 | 42 |
/// but its nodes have at most four children, instead of two. |
... | ... |
@@ -49,3 +50,3 @@ |
49 | 50 |
///\sa BinHeap |
50 |
///\sa |
|
51 |
///\sa DHeap |
|
51 | 52 |
#ifdef DOXYGEN |
... | ... |
@@ -55,3 +56,3 @@ |
55 | 56 |
#endif |
56 |
class |
|
57 |
class QuadHeap { |
|
57 | 58 |
public: |
... | ... |
@@ -94,3 +95,3 @@ |
94 | 95 |
/// The assigned value must be \c PRE_HEAP (<tt>-1</tt>) for each item. |
95 |
explicit |
|
96 |
explicit QuadHeap(ItemIntMap &map) : _iim(map) {} |
|
96 | 97 |
|
... | ... |
@@ -103,3 +104,3 @@ |
103 | 104 |
/// \param comp The function object used for comparing the priorities. |
104 |
|
|
105 |
QuadHeap(ItemIntMap &map, const Compare &comp) |
|
105 | 106 |
: _iim(map), _comp(comp) {} |
... | ... |
@@ -337,3 +338,3 @@ |
337 | 338 |
|
338 |
}; // class |
|
339 |
}; // class QuadHeap |
|
339 | 340 |
... | ... |
@@ -32,4 +32,4 @@ |
32 | 32 |
#include <lemon/bin_heap.h> |
33 |
#include <lemon/fourary_heap.h> |
|
34 |
#include <lemon/kary_heap.h> |
|
33 |
#include <lemon/quad_heap.h> |
|
34 |
#include <lemon/dheap.h> |
|
35 | 35 |
#include <lemon/fib_heap.h> |
... | ... |
@@ -37,3 +37,3 @@ |
37 | 37 |
#include <lemon/radix_heap.h> |
38 |
#include <lemon/ |
|
38 |
#include <lemon/binomial_heap.h> |
|
39 | 39 |
#include <lemon/bucket_heap.h> |
... | ... |
@@ -187,5 +187,5 @@ |
187 | 187 |
|
188 |
// |
|
188 |
// QuadHeap |
|
189 | 189 |
{ |
190 |
typedef |
|
190 |
typedef QuadHeap<Prio, ItemIntMap> IntHeap; |
|
191 | 191 |
checkConcept<Heap<Prio, ItemIntMap>, IntHeap>(); |
... | ... |
@@ -194,3 +194,3 @@ |
194 | 194 |
|
195 |
typedef |
|
195 |
typedef QuadHeap<Prio, IntNodeMap > NodeHeap; |
|
196 | 196 |
checkConcept<Heap<Prio, IntNodeMap >, NodeHeap>(); |
... | ... |
@@ -199,5 +199,5 @@ |
199 | 199 |
|
200 |
// |
|
200 |
// DHeap |
|
201 | 201 |
{ |
202 |
typedef |
|
202 |
typedef DHeap<Prio, ItemIntMap> IntHeap; |
|
203 | 203 |
checkConcept<Heap<Prio, ItemIntMap>, IntHeap>(); |
... | ... |
@@ -206,3 +206,3 @@ |
206 | 206 |
|
207 |
typedef |
|
207 |
typedef DHeap<Prio, IntNodeMap > NodeHeap; |
|
208 | 208 |
checkConcept<Heap<Prio, IntNodeMap >, NodeHeap>(); |
... | ... |
@@ -247,5 +247,5 @@ |
247 | 247 |
|
248 |
// |
|
248 |
// BinomialHeap |
|
249 | 249 |
{ |
250 |
typedef |
|
250 |
typedef BinomialHeap<Prio, ItemIntMap> IntHeap; |
|
251 | 251 |
checkConcept<Heap<Prio, ItemIntMap>, IntHeap>(); |
... | ... |
@@ -254,3 +254,3 @@ |
254 | 254 |
|
255 |
typedef |
|
255 |
typedef BinomialHeap<Prio, IntNodeMap > NodeHeap; |
|
256 | 256 |
checkConcept<Heap<Prio, IntNodeMap >, NodeHeap>(); |
0 comments (0 inline)