Index: lemon/bucket_heap.h
===================================================================
--- lemon/bucket_heap.h	(revision 729)
+++ lemon/bucket_heap.h	(revision 730)
@@ -32,5 +32,5 @@
   namespace _bucket_heap_bits {
 
-    template <bool minimize>
+    template <bool MIN>
     struct DirectionTraits {
       static bool less(int left, int right) {
@@ -66,14 +66,15 @@
   /// the priorities are small. It is not intended to use as dijkstra heap.
   ///
-  /// \param _ItemIntMap A read and writable Item int map, used internally
+  /// \param IM A read and write Item int map, used internally
   /// to handle the cross references.
-  /// \param minimize If the given parameter is true then the heap gives back
-  /// the lowest priority.
-  template <typename _ItemIntMap, bool minimize = true>
+  /// \param MIN If the given parameter is false then instead of the
+  /// minimum value the maximum can be retrivied with the top() and
+  /// prio() member functions.
+  template <typename IM, bool MIN = true>
   class BucketHeap {
 
   public:
     /// \e
-    typedef typename _ItemIntMap::Key Item;
+    typedef typename IM::Key Item;
     /// \e
     typedef int Prio;
@@ -81,9 +82,9 @@
     typedef std::pair<Item, Prio> Pair;
     /// \e
-    typedef _ItemIntMap ItemIntMap;
+    typedef IM ItemIntMap;
 
   private:
 
-    typedef _bucket_heap_bits::DirectionTraits<minimize> Direction;
+    typedef _bucket_heap_bits::DirectionTraits<MIN> Direction;
 
   public:
@@ -95,10 +96,10 @@
     /// heap's point of view, but may be useful to the user.
     ///
-    /// The ItemIntMap \e should be initialized in such way that it maps
-    /// PRE_HEAP (-1) to any element to be put in the heap...
+    /// The item-int map must be initialized in such way that it assigns
+    /// \c PRE_HEAP (<tt>-1</tt>) to any element to be put in the heap.
     enum State {
-      IN_HEAP = 0,
-      PRE_HEAP = -1,
-      POST_HEAP = -2
+      IN_HEAP = 0,    ///< = 0.
+      PRE_HEAP = -1,  ///< = -1.
+      POST_HEAP = -2  ///< = -2.
     };
 
@@ -107,18 +108,18 @@
     ///
     /// The constructor.
-    /// \param _index should be given to the constructor, since it is used
+    /// \param map should be given to the constructor, since it is used
     /// internally to handle the cross references. The value of the map
     /// should be PRE_HEAP (-1) for each element.
-    explicit BucketHeap(ItemIntMap &_index) : index(_index), minimal(0) {}
+    explicit BucketHeap(ItemIntMap &map) : _iim(map), _minimum(0) {}
 
     /// The number of items stored in the heap.
     ///
     /// \brief Returns the number of items stored in the heap.
-    int size() const { return data.size(); }
+    int size() const { return _data.size(); }
 
     /// \brief Checks if the heap stores no items.
     ///
     /// Returns \c true if and only if the heap stores no items.
-    bool empty() const { return data.empty(); }
+    bool empty() const { return _data.empty(); }
 
     /// \brief Make empty this heap.
@@ -129,5 +130,5 @@
     /// cross reference map for each item to \c PRE_HEAP.
     void clear() {
-      data.clear(); first.clear(); minimal = 0;
+      _data.clear(); _first.clear(); _minimum = 0;
     }
 
@@ -135,40 +136,40 @@
 
     void relocate_last(int idx) {
-      if (idx + 1 < int(data.size())) {
-        data[idx] = data.back();
-        if (data[idx].prev != -1) {
-          data[data[idx].prev].next = idx;
+      if (idx + 1 < int(_data.size())) {
+        _data[idx] = _data.back();
+        if (_data[idx].prev != -1) {
+          _data[_data[idx].prev].next = idx;
         } else {
-          first[data[idx].value] = idx;
+          _first[_data[idx].value] = idx;
         }
-        if (data[idx].next != -1) {
-          data[data[idx].next].prev = idx;
+        if (_data[idx].next != -1) {
+          _data[_data[idx].next].prev = idx;
         }
-        index[data[idx].item] = idx;
-      }
-      data.pop_back();
+        _iim[_data[idx].item] = idx;
+      }
+      _data.pop_back();
     }
 
     void unlace(int idx) {
-      if (data[idx].prev != -1) {
-        data[data[idx].prev].next = data[idx].next;
+      if (_data[idx].prev != -1) {
+        _data[_data[idx].prev].next = _data[idx].next;
       } else {
-        first[data[idx].value] = data[idx].next;
-      }
-      if (data[idx].next != -1) {
-        data[data[idx].next].prev = data[idx].prev;
+        _first[_data[idx].value] = _data[idx].next;
+      }
+      if (_data[idx].next != -1) {
+        _data[_data[idx].next].prev = _data[idx].prev;
       }
     }
 
     void lace(int idx) {
-      if (int(first.size()) <= data[idx].value) {
-        first.resize(data[idx].value + 1, -1);
-      }
-      data[idx].next = first[data[idx].value];
-      if (data[idx].next != -1) {
-        data[data[idx].next].prev = idx;
-      }
-      first[data[idx].value] = idx;
-      data[idx].prev = -1;
+      if (int(_first.size()) <= _data[idx].value) {
+        _first.resize(_data[idx].value + 1, -1);
+      }
+      _data[idx].next = _first[_data[idx].value];
+      if (_data[idx].next != -1) {
+        _data[_data[idx].next].prev = idx;
+      }
+      _first[_data[idx].value] = idx;
+      _data[idx].prev = -1;
     }
 
@@ -188,10 +189,10 @@
     /// \param p The priority of the item.
     void push(const Item &i, const Prio &p) {
-      int idx = data.size();
-      index[i] = idx;
-      data.push_back(BucketItem(i, p));
+      int idx = _data.size();
+      _iim[i] = idx;
+      _data.push_back(BucketItem(i, p));
       lace(idx);
-      if (Direction::less(p, minimal)) {
-        minimal = p;
+      if (Direction::less(p, _minimum)) {
+        _minimum = p;
       }
     }
@@ -202,8 +203,8 @@
     /// \pre The heap must be nonempty.
     Item top() const {
-      while (first[minimal] == -1) {
-        Direction::increase(minimal);
-      }
-      return data[first[minimal]].item;
+      while (_first[_minimum] == -1) {
+        Direction::increase(_minimum);
+      }
+      return _data[_first[_minimum]].item;
     }
 
@@ -213,8 +214,8 @@
     /// \pre The heap must be nonempty.
     Prio prio() const {
-      while (first[minimal] == -1) {
-        Direction::increase(minimal);
-      }
-      return minimal;
+      while (_first[_minimum] == -1) {
+        Direction::increase(_minimum);
+      }
+      return _minimum;
     }
 
@@ -224,9 +225,9 @@
     /// \pre The heap must be non-empty.
     void pop() {
-      while (first[minimal] == -1) {
-        Direction::increase(minimal);
-      }
-      int idx = first[minimal];
-      index[data[idx].item] = -2;
+      while (_first[_minimum] == -1) {
+        Direction::increase(_minimum);
+      }
+      int idx = _first[_minimum];
+      _iim[_data[idx].item] = -2;
       unlace(idx);
       relocate_last(idx);
@@ -239,6 +240,6 @@
     /// \param i The item to erase.
     void erase(const Item &i) {
-      int idx = index[i];
-      index[data[idx].item] = -2;
+      int idx = _iim[i];
+      _iim[_data[idx].item] = -2;
       unlace(idx);
       relocate_last(idx);
@@ -252,6 +253,6 @@
     /// \param i The item.
     Prio operator[](const Item &i) const {
-      int idx = index[i];
-      return data[idx].value;
+      int idx = _iim[i];
+      return _data[idx].value;
     }
 
@@ -264,8 +265,8 @@
     /// \param p The priority.
     void set(const Item &i, const Prio &p) {
-      int idx = index[i];
+      int idx = _iim[i];
       if (idx < 0) {
         push(i, p);
-      } else if (Direction::less(p, data[idx].value)) {
+      } else if (Direction::less(p, _data[idx].value)) {
         decrease(i, p);
       } else {
@@ -282,9 +283,9 @@
     /// \param p The priority.
     void decrease(const Item &i, const Prio &p) {
-      int idx = index[i];
+      int idx = _iim[i];
       unlace(idx);
-      data[idx].value = p;
-      if (Direction::less(p, minimal)) {
-        minimal = p;
+      _data[idx].value = p;
+      if (Direction::less(p, _minimum)) {
+        _minimum = p;
       }
       lace(idx);
@@ -299,7 +300,7 @@
     /// \param p The priority.
     void increase(const Item &i, const Prio &p) {
-      int idx = index[i];
+      int idx = _iim[i];
       unlace(idx);
-      data[idx].value = p;
+      _data[idx].value = p;
       lace(idx);
     }
@@ -314,5 +315,5 @@
     /// \param i The item.
     State state(const Item &i) const {
-      int idx = index[i];
+      int idx = _iim[i];
       if (idx >= 0) idx = 0;
       return State(idx);
@@ -333,5 +334,5 @@
           erase(i);
         }
-        index[i] = st;
+        _iim[i] = st;
         break;
       case IN_HEAP:
@@ -352,8 +353,8 @@
     };
 
-    ItemIntMap& index;
-    std::vector<int> first;
-    std::vector<BucketItem> data;
-    mutable int minimal;
+    ItemIntMap& _iim;
+    std::vector<int> _first;
+    std::vector<BucketItem> _data;
+    mutable int _minimum;
 
   }; // class BucketHeap
@@ -371,22 +372,23 @@
   /// minimal and it does not supports key increasing, decreasing.
   ///
-  /// \param _ItemIntMap A read and writable Item int map, used internally
+  /// \param IM A read and write Item int map, used internally
   /// to handle the cross references.
-  /// \param minimize If the given parameter is true then the heap gives back
-  /// the lowest priority.
+  /// \param MIN If the given parameter is false then instead of the
+  /// minimum value the maximum can be retrivied with the top() and
+  /// prio() member functions.
   ///
   /// \sa BucketHeap
-  template <typename _ItemIntMap, bool minimize = true >
+  template <typename IM, bool MIN = true >
   class SimpleBucketHeap {
 
   public:
-    typedef typename _ItemIntMap::Key Item;
+    typedef typename IM::Key Item;
     typedef int Prio;
     typedef std::pair<Item, Prio> Pair;
-    typedef _ItemIntMap ItemIntMap;
+    typedef IM ItemIntMap;
 
   private:
 
-    typedef _bucket_heap_bits::DirectionTraits<minimize> Direction;
+    typedef _bucket_heap_bits::DirectionTraits<MIN> Direction;
 
   public:
@@ -398,10 +400,10 @@
     /// heap's point of view, but may be useful to the user.
     ///
-    /// The ItemIntMap \e should be initialized in such way that it maps
-    /// PRE_HEAP (-1) to any element to be put in the heap...
+    /// The item-int map must be initialized in such way that it assigns
+    /// \c PRE_HEAP (<tt>-1</tt>) to any element to be put in the heap.
     enum State {
-      IN_HEAP = 0,
-      PRE_HEAP = -1,
-      POST_HEAP = -2
+      IN_HEAP = 0,    ///< = 0.
+      PRE_HEAP = -1,  ///< = -1.
+      POST_HEAP = -2  ///< = -2.
     };
 
@@ -411,19 +413,19 @@
     ///
     /// The constructor.
-    /// \param _index should be given to the constructor, since it is used
+    /// \param map should be given to the constructor, since it is used
     /// internally to handle the cross references. The value of the map
     /// should be PRE_HEAP (-1) for each element.
-    explicit SimpleBucketHeap(ItemIntMap &_index)
-      : index(_index), free(-1), num(0), minimal(0) {}
+    explicit SimpleBucketHeap(ItemIntMap &map)
+      : _iim(map), _free(-1), _num(0), _minimum(0) {}
 
     /// \brief Returns the number of items stored in the heap.
     ///
     /// The number of items stored in the heap.
-    int size() const { return num; }
+    int size() const { return _num; }
 
     /// \brief Checks if the heap stores no items.
     ///
     /// Returns \c true if and only if the heap stores no items.
-    bool empty() const { return num == 0; }
+    bool empty() const { return _num == 0; }
 
     /// \brief Make empty this heap.
@@ -434,5 +436,5 @@
     /// cross reference map for each item to \c PRE_HEAP.
     void clear() {
-      data.clear(); first.clear(); free = -1; num = 0; minimal = 0;
+      _data.clear(); _first.clear(); _free = -1; _num = 0; _minimum = 0;
     }
 
@@ -452,20 +454,20 @@
     void push(const Item &i, const Prio &p) {
       int idx;
-      if (free == -1) {
-        idx = data.size();
-        data.push_back(BucketItem(i));
+      if (_free == -1) {
+        idx = _data.size();
+        _data.push_back(BucketItem(i));
       } else {
-        idx = free;
-        free = data[idx].next;
-        data[idx].item = i;
-      }
-      index[i] = idx;
-      if (p >= int(first.size())) first.resize(p + 1, -1);
-      data[idx].next = first[p];
-      first[p] = idx;
-      if (Direction::less(p, minimal)) {
-        minimal = p;
-      }
-      ++num;
+        idx = _free;
+        _free = _data[idx].next;
+        _data[idx].item = i;
+      }
+      _iim[i] = idx;
+      if (p >= int(_first.size())) _first.resize(p + 1, -1);
+      _data[idx].next = _first[p];
+      _first[p] = idx;
+      if (Direction::less(p, _minimum)) {
+        _minimum = p;
+      }
+      ++_num;
     }
 
@@ -475,8 +477,8 @@
     /// \pre The heap must be nonempty.
     Item top() const {
-      while (first[minimal] == -1) {
-        Direction::increase(minimal);
-      }
-      return data[first[minimal]].item;
+      while (_first[_minimum] == -1) {
+        Direction::increase(_minimum);
+      }
+      return _data[_first[_minimum]].item;
     }
 
@@ -486,8 +488,8 @@
     /// \pre The heap must be nonempty.
     Prio prio() const {
-      while (first[minimal] == -1) {
-        Direction::increase(minimal);
-      }
-      return minimal;
+      while (_first[_minimum] == -1) {
+        Direction::increase(_minimum);
+      }
+      return _minimum;
     }
 
@@ -497,13 +499,13 @@
     /// \pre The heap must be non-empty.
     void pop() {
-      while (first[minimal] == -1) {
-        Direction::increase(minimal);
-      }
-      int idx = first[minimal];
-      index[data[idx].item] = -2;
-      first[minimal] = data[idx].next;
-      data[idx].next = free;
-      free = idx;
-      --num;
+      while (_first[_minimum] == -1) {
+        Direction::increase(_minimum);
+      }
+      int idx = _first[_minimum];
+      _iim[_data[idx].item] = -2;
+      _first[_minimum] = _data[idx].next;
+      _data[idx].next = _free;
+      _free = idx;
+      --_num;
     }
 
@@ -517,11 +519,11 @@
     /// \param i The item.
     Prio operator[](const Item &i) const {
-      for (int k = 0; k < first.size(); ++k) {
-        int idx = first[k];
+      for (int k = 0; k < _first.size(); ++k) {
+        int idx = _first[k];
         while (idx != -1) {
-          if (data[idx].item == i) {
+          if (_data[idx].item == i) {
             return k;
           }
-          idx = data[idx].next;
+          idx = _data[idx].next;
         }
       }
@@ -538,5 +540,5 @@
     /// \param i The item.
     State state(const Item &i) const {
-      int idx = index[i];
+      int idx = _iim[i];
       if (idx >= 0) idx = 0;
       return State(idx);
@@ -553,9 +555,9 @@
     };
 
-    ItemIntMap& index;
-    std::vector<int> first;
-    std::vector<BucketItem> data;
-    int free, num;
-    mutable int minimal;
+    ItemIntMap& _iim;
+    std::vector<int> _first;
+    std::vector<BucketItem> _data;
+    int _free, _num;
+    mutable int _minimum;
 
   }; // class SimpleBucketHeap
