COIN-OR::LEMON - Graph Library

Changeset 1902:e9af75c90c28 in lemon-0.x for lemon/radix_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/radix_heap.h

    r1875 r1902  
    407407    }
    408408
     409    /// \brief Sets the state of the \c item in the heap.
     410    ///
     411    /// Sets the state of the \c item in the heap. It can be used to
     412    /// manually clear the heap when it is important to achive the
     413    /// better time complexity.
     414    /// \param i The item.
     415    /// \param st The state. It should not be \c IN_HEAP.
     416    void state(const Item& i, state_enum st) {
     417      switch (st) {
     418      case POST_HEAP:
     419      case PRE_HEAP:
     420        if (state(i) == IN_HEAP) {
     421          erase(i);
     422        }
     423        index[i] = st;
     424        break;
     425      }
     426    }
     427
    409428  }; // class RadixHeap
    410429
Note: See TracChangeset for help on using the changeset viewer.