diff -r f393a8162688 -r a3ba22ebccc6 lemon/bin_heap.h --- a/lemon/bin_heap.h Thu Dec 27 13:40:16 2007 +0000 +++ b/lemon/bin_heap.h Fri Dec 28 11:00:51 2007 +0000 @@ -52,10 +52,15 @@ class BinHeap { public: + ///\e typedef _ItemIntMap ItemIntMap; + ///\e typedef _Prio Prio; + ///\e typedef typename ItemIntMap::Key Item; + ///\e typedef std::pair Pair; + ///\e typedef _Compare Compare; /// \brief Type to represent the items states. @@ -321,6 +326,19 @@ } } + /// \brief Replaces an item in the heap. + /// + /// The \c i item is replaced with \c j item. The \c i item should + /// be in the heap, while the \c j should be out of the heap. The + /// \c i item will out of the heap and \c j will be in the heap + /// with the same prioriority as prevoiusly the \c i item. + void replace(const Item& i, const Item& j) { + int idx = iim[i]; + iim.set(i, iim[j]); + iim.set(j, idx); + data[idx].first = j; + } + }; // class BinHeap } // namespace lemon