1.1 --- a/lemon/radix_heap.h Thu Jun 11 22:16:11 2009 +0200
1.2 +++ b/lemon/radix_heap.h Thu Jun 11 23:13:24 2009 +0200
1.3 @@ -41,18 +41,18 @@
1.4 /// item, but the priority cannot be decreased under the last removed
1.5 /// item's priority.
1.6 ///
1.7 - /// \param _ItemIntMap A read and writable Item int map, used internally
1.8 + /// \param IM A read and writable Item int map, used internally
1.9 /// to handle the cross references.
1.10 ///
1.11 /// \see BinHeap
1.12 /// \see Dijkstra
1.13 - template <typename _ItemIntMap>
1.14 + template <typename IM>
1.15 class RadixHeap {
1.16
1.17 public:
1.18 - typedef typename _ItemIntMap::Key Item;
1.19 + typedef typename IM::Key Item;
1.20 typedef int Prio;
1.21 - typedef _ItemIntMap ItemIntMap;
1.22 + typedef IM ItemIntMap;
1.23
1.24 /// \brief Exception thrown by RadixHeap.
1.25 ///
1.26 @@ -99,7 +99,7 @@
1.27 std::vector<RadixItem> data;
1.28 std::vector<RadixBox> boxes;
1.29
1.30 - ItemIntMap &iim;
1.31 + ItemIntMap &_iim;
1.32
1.33
1.34 public:
1.35 @@ -107,14 +107,14 @@
1.36 ///
1.37 /// The constructor.
1.38 ///
1.39 - /// \param _iim It should be given to the constructor, since it is used
1.40 + /// \param map It should be given to the constructor, since it is used
1.41 /// internally to handle the cross references. The value of the map
1.42 /// should be PRE_HEAP (-1) for each element.
1.43 ///
1.44 /// \param minimal The initial minimal value of the heap.
1.45 /// \param capacity It determines the initial capacity of the heap.
1.46 - RadixHeap(ItemIntMap &_iim, int minimal = 0, int capacity = 0)
1.47 - : iim(_iim) {
1.48 + RadixHeap(ItemIntMap &map, int minimal = 0, int capacity = 0)
1.49 + : _iim(map) {
1.50 boxes.push_back(RadixBox(minimal, 1));
1.51 boxes.push_back(RadixBox(minimal + 1, 1));
1.52 while (lower(boxes.size() - 1, capacity + minimal - 1)) {
1.53 @@ -268,7 +268,7 @@
1.54 if (data[index].next != -1) {
1.55 data[data[index].next].prev = index;
1.56 }
1.57 - iim[data[index].item] = index;
1.58 + _iim[data[index].item] = index;
1.59 }
1.60 data.pop_back();
1.61 }
1.62 @@ -282,7 +282,7 @@
1.63 /// \param p The priority of the item.
1.64 void push(const Item &i, const Prio &p) {
1.65 int n = data.size();
1.66 - iim.set(i, n);
1.67 + _iim.set(i, n);
1.68 data.push_back(RadixItem(i, p));
1.69 while (lower(boxes.size() - 1, p)) {
1.70 extend();
1.71 @@ -316,7 +316,7 @@
1.72 void pop() {
1.73 moveDown();
1.74 int index = boxes[0].first;
1.75 - iim[data[index].item] = POST_HEAP;
1.76 + _iim[data[index].item] = POST_HEAP;
1.77 remove(index);
1.78 relocate_last(index);
1.79 }
1.80 @@ -327,8 +327,8 @@
1.81 /// already stored in the heap.
1.82 /// \param i The item to erase.
1.83 void erase(const Item &i) {
1.84 - int index = iim[i];
1.85 - iim[i] = POST_HEAP;
1.86 + int index = _iim[i];
1.87 + _iim[i] = POST_HEAP;
1.88 remove(index);
1.89 relocate_last(index);
1.90 }
1.91 @@ -339,7 +339,7 @@
1.92 /// \pre \c i must be in the heap.
1.93 /// \param i The item.
1.94 Prio operator[](const Item &i) const {
1.95 - int idx = iim[i];
1.96 + int idx = _iim[i];
1.97 return data[idx].prio;
1.98 }
1.99
1.100 @@ -352,7 +352,7 @@
1.101 /// \param i The item.
1.102 /// \param p The priority.
1.103 void set(const Item &i, const Prio &p) {
1.104 - int idx = iim[i];
1.105 + int idx = _iim[i];
1.106 if( idx < 0 ) {
1.107 push(i, p);
1.108 }
1.109 @@ -374,7 +374,7 @@
1.110 /// \param i The item.
1.111 /// \param p The priority.
1.112 void decrease(const Item &i, const Prio &p) {
1.113 - int idx = iim[i];
1.114 + int idx = _iim[i];
1.115 data[idx].prio = p;
1.116 bubble_down(idx);
1.117 }
1.118 @@ -386,7 +386,7 @@
1.119 /// \param i The item.
1.120 /// \param p The priority.
1.121 void increase(const Item &i, const Prio &p) {
1.122 - int idx = iim[i];
1.123 + int idx = _iim[i];
1.124 data[idx].prio = p;
1.125 bubble_up(idx);
1.126 }
1.127 @@ -400,7 +400,7 @@
1.128 /// get back to the heap again.
1.129 /// \param i The item.
1.130 State state(const Item &i) const {
1.131 - int s = iim[i];
1.132 + int s = _iim[i];
1.133 if( s >= 0 ) s = 0;
1.134 return State(s);
1.135 }
1.136 @@ -419,7 +419,7 @@
1.137 if (state(i) == IN_HEAP) {
1.138 erase(i);
1.139 }
1.140 - iim[i] = st;
1.141 + _iim[i] = st;
1.142 break;
1.143 case IN_HEAP:
1.144 break;