diff -r 723b2b81d900 -r e9af75c90c28 lemon/bin_heap.h --- a/lemon/bin_heap.h Tue Jan 24 16:07:38 2006 +0000 +++ b/lemon/bin_heap.h Wed Jan 25 12:10:18 2006 +0000 @@ -267,6 +267,25 @@ return state_enum(s); } + /// \brief Sets the state of the \c item in the heap. + /// + /// Sets the state of the \c item in the heap. It can be used to + /// manually clear the heap when it is important to achive the + /// better time complexity. + /// \param i The item. + /// \param st The state. It should not be \c IN_HEAP. + void state(const Item& i, state_enum st) { + switch (st) { + case POST_HEAP: + case PRE_HEAP: + if (state(i) == IN_HEAP) { + erase(i); + } + index[i] = st; + break; + } + } + }; // class BinHeap