SNAP Library 2.4, User Reference
2015-05-11 19:40:56
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
|
Simple heap data structure. More...
#include <gbase.h>
Public Member Functions | |
THeap () | |
THeap (const int &MxVals) | |
THeap (const TCmp &_Cmp) | |
THeap (const TVec< TVal > &Vec) | |
THeap (const TVec< TVal > &Vec, const TCmp &_Cmp) | |
THeap (const THeap &Heap) | |
THeap & | operator= (const THeap &H) |
const TVal & | TopHeap () const |
Returns a reference to the element at the top of the heap (the largest element of the heap). More... | |
void | PushHeap (const TVal &Val) |
Pushes an element Val to the heap. More... | |
TVal | PopHeap () |
Removes the top element from the heap. More... | |
int | Len () const |
Returns the number of elements in the heap. More... | |
bool | Empty () const |
Tests whether the heap is empty. More... | |
const TVec< TVal > & | operator() () const |
Returns a reference to the vector containing the elements of the heap. More... | |
TVec< TVal > & | operator() () |
Returns a reference to the vector containing the elements of the heap. More... | |
void | Add (const TVal &Val) |
Adds an element to the data structure. Heap property is not maintained by Add() and thus after all the elements are added MakeHeap() needs to be called. More... | |
void | MakeHeap () |
Builds a heap from a set of elements. More... | |
Private Member Functions | |
void | PushHeap (const int &First, int HoleIdx, const int &Top, TVal Val) |
void | AdjustHeap (const int &First, int HoleIdx, const int &Len, TVal Val) |
void | MakeHeap (const int &First, const int &Len) |
Private Attributes | |
TCmp | Cmp |
TVec< TVal > | HeapV |
Simple heap data structure.
Data structure provides insertion of elements, and inspection and removal of the top element. It is guaranteed that the top element is the largest element in the heap, where the function object TCmp
is used for comparisons.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Adds an element to the data structure. Heap property is not maintained by Add()
and thus after all the elements are added MakeHeap()
needs to be called.
Definition at line 285 of file gbase.h.
|
private |
Definition at line 319 of file gbase.h.
|
private |
Definition at line 333 of file gbase.h.
|
inline |
|
inline |
|
inline |
Removes the top element from the heap.
Definition at line 297 of file gbase.h.
|
private |
Pushes an element Val
to the heap.
Definition at line 291 of file gbase.h.
|
inline |