COIN-OR::LEMON - Graph Library

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


Ignore:
Timestamp:
01/25/06 13:10:18 (19 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/bin_heap.h

    r1875 r1902  
    268268    }
    269269
     270    /// \brief Sets the state of the \c item in the heap.
     271    ///
     272    /// Sets the state of the \c item in the heap. It can be used to
     273    /// manually clear the heap when it is important to achive the
     274    /// better time complexity.
     275    /// \param i The item.
     276    /// \param st The state. It should not be \c IN_HEAP.
     277    void state(const Item& i, state_enum st) {
     278      switch (st) {
     279      case POST_HEAP:
     280      case PRE_HEAP:
     281        if (state(i) == IN_HEAP) {
     282          erase(i);
     283        }
     284        index[i] = st;
     285        break;
     286      }
     287    }
     288
    270289  }; // class BinHeap
    271290
Note: See TracChangeset for help on using the changeset viewer.