1.1 --- a/lemon/bin_heap.h Thu Dec 27 13:40:16 2007 +0000
1.2 +++ b/lemon/bin_heap.h Fri Dec 28 11:00:51 2007 +0000
1.3 @@ -52,10 +52,15 @@
1.4 class BinHeap {
1.5
1.6 public:
1.7 + ///\e
1.8 typedef _ItemIntMap ItemIntMap;
1.9 + ///\e
1.10 typedef _Prio Prio;
1.11 + ///\e
1.12 typedef typename ItemIntMap::Key Item;
1.13 + ///\e
1.14 typedef std::pair<Item,Prio> Pair;
1.15 + ///\e
1.16 typedef _Compare Compare;
1.17
1.18 /// \brief Type to represent the items states.
1.19 @@ -321,6 +326,19 @@
1.20 }
1.21 }
1.22
1.23 + /// \brief Replaces an item in the heap.
1.24 + ///
1.25 + /// The \c i item is replaced with \c j item. The \c i item should
1.26 + /// be in the heap, while the \c j should be out of the heap. The
1.27 + /// \c i item will out of the heap and \c j will be in the heap
1.28 + /// with the same prioriority as prevoiusly the \c i item.
1.29 + void replace(const Item& i, const Item& j) {
1.30 + int idx = iim[i];
1.31 + iim.set(i, iim[j]);
1.32 + iim.set(j, idx);
1.33 + data[idx].first = j;
1.34 + }
1.35 +
1.36 }; // class BinHeap
1.37
1.38 } // namespace lemon