|
Open Graph Drawing Framework |
v. 2023.09 (Elderberry)
|
|
|
Go to the documentation of this file.
53 template<
class X,
class INDEX =
int>
111 while ((papa = idx / 2) > 0) {
113 data.swap(papa, idx);
125 if ((son = 2 * papa) <
num &&
data[son + 1] <
data[son]) {
129 data.swap(papa, son);
147 template<
class X,
class INDEX =
int>
246 template<
class X,
class Priority =
double,
class STATICCOMPARER = StdComparer<X>,
class INDEX =
int>
The namespace for all OGDF objects.
void pushAndDelete(X *x, Priority p)
Inserts the element x into the heap with priority p and deletes the element with smallest priority if...
static bool successful(PushResult r)
Convenience function: Returns true if the PushResults states that the newly pushed element is new in ...
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
void insertAndDeleteNoRedundancy(X *x, Priority p)
Alternative name for pushAndKillNoRedundancy().
Top10Heap()
Constructor generating a heap which holds the 10 elements with highest value ever added to the heap.
void insertAndDelete(X *x, Priority p)
Alternative name for pushAndDelete().
void insert(X &x)
Adds an element to the heap [Same as push(), O(log n)].
A variant of BinaryHeapSimple which always holds only the 10 elements with the highest keys.
INDEX size() const
Returns the number of elements in the heap.
const X & operator[](INDEX idx) const
obtain const references to the element at index idx (the smallest array index is 0,...
X pop()
Returns the top (i.e., smallest) element and removed it from the heap [Same as extractMin(),...
void pushBlind(X &x)
Simple (and slightly faster) variant of Top10Heap::push.
Dynamically growing binary heap tuned for efficiency on a small interface (compared to BinaryHeap).
void pushAndDeleteNoRedundancy(X *x, Priority p)
Analogous to pushandDelete(), but furthermore rejects (and deletes) an element if an equal element is...
const X & top() const
Returns a reference to the top (i.e., smallest) element of the heap. It does not remove it....
A variant of Top10Heap which deletes the elements that get rejected from the heap.
bool full() const
Returns true if the heap is completely filled (i.e. the next push operation will return something)
BinaryHeapSimple(INDEX size)
Construtor, giving initial array size.
The parameterized class Array implements dynamic arrays of type E.
bool empty() const
Returns true if the heap is empty.
void push(X &x)
Adds an element to the heap [Same as insert(), O(log n)].
const X & getMin() const
Returns a reference to the top (i.e., smallest) element of the heap. It does not remove it....
PushResult push(X &x, X &out)
Tries to push the element x onto the heap (and may return a removed element as out).
static bool returnedSomething(PushResult r)
Convenience function: Returns true if the PushResults states that push caused an element to be not/no...
A static comparer which compares the target of pointers ("content"), instead of the pointer's adresse...
DeletingTop10Heap(int size)
Construct a DeletingTop10Heap of given maximal capacity.
INDEX capacity() const
Returns the current array-size of the heap, i.e., the number of elements which can be added before th...
Declaration and implementation of Array class and Array algorithms.
Augments any data elements of type X with keys of type Priority. This class is also its own Comparer.
const X & operator[](INDEX idx) const
obtain const references to the element at index idx
PushResult insert(X &x, X &out)
Alternative name for push().
void clear()
empties the heap [O(1)]
void insertBlind(X &x)
Alternative name for pushBlind().
X extractMin()
Returns the top (i.e., smallest) element and removed it from the heap [Same as pop(),...
Declarations for Comparer objects.
PushResult
The type for results of a Top10Heap::push operation.
X item() const
Returns the data of the element.