COIN-OR::LEMON - Graph Library

Changeset 1902:e9af75c90c28 in lemon-0.x for lemon/fib_heap.h


Ignore:
Timestamp:
01/25/06 13:10:18 (14 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2477
Message:

state setting function for heaps

If we know that which elements were in the heap then
we can clear it in better time complexity.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/fib_heap.h

    r1875 r1902  
    217217      return state_enum(i);
    218218    }   
     219
     220    /// \brief Sets the state of the \c item in the heap.
     221    ///
     222    /// Sets the state of the \c item in the heap. It can be used to
     223    /// manually clear the heap when it is important to achive the
     224    /// better time complexity.
     225    /// \param i The item.
     226    /// \param st The state. It should not be \c IN_HEAP.
     227    void state(const Item& i, state_enum st) {
     228      switch (st) {
     229      case POST_HEAP:
     230      case PRE_HEAP:
     231        if (state(i) == IN_HEAP) {
     232          erase(i);
     233        }
     234        index[i] = st;
     235        break;
     236      }
     237    }
    219238   
    220239  private:
Note: See TracChangeset for help on using the changeset viewer.