1.1 --- a/lemon/fib_heap.h Tue Jan 24 16:07:38 2006 +0000
1.2 +++ b/lemon/fib_heap.h Wed Jan 25 12:10:18 2006 +0000
1.3 @@ -216,6 +216,25 @@
1.4 }
1.5 return state_enum(i);
1.6 }
1.7 +
1.8 + /// \brief Sets the state of the \c item in the heap.
1.9 + ///
1.10 + /// Sets the state of the \c item in the heap. It can be used to
1.11 + /// manually clear the heap when it is important to achive the
1.12 + /// better time complexity.
1.13 + /// \param i The item.
1.14 + /// \param st The state. It should not be \c IN_HEAP.
1.15 + void state(const Item& i, state_enum st) {
1.16 + switch (st) {
1.17 + case POST_HEAP:
1.18 + case PRE_HEAP:
1.19 + if (state(i) == IN_HEAP) {
1.20 + erase(i);
1.21 + }
1.22 + index[i] = st;
1.23 + break;
1.24 + }
1.25 + }
1.26
1.27 private:
1.28