23 #include <boost/heap/d_ary_heap.hpp>
25 #include <fast_methods/datastructures/fmcompare.hpp>
31 typedef boost::heap::d_ary_heap<const cell_t *, boost::heap::mutable_<true>, boost::heap::arity<2>, boost::heap::compare<FMCompare<cell_t>> >
d_ary_heap_t;
34 typedef typename d_ary_heap_t::handle_type
handle_t;
59 const unsigned int idx =
heap_.top()->getIndex();
std::vector< handle_t > handles_
Stores the handles of each cell by keeping the indices: handles_(0) is the handle for the cell with i...
d_ary_heap_t::handle_type handle_t
Shorthand for heap element handle type.
d_ary_heap_t heap_
The actual heap for cell_t.
void setMaxSize(const size_t &n)
Sets the maximum number of cells the heap will contain.
Wrap for the Boost D-ary Heap class to be used as a binary heap in the FM algorithms. Ready to be used with FMCell and derived types.
void increase(const cell_t *c)
Updates the position of the cell in the heap. Its priority can only increase. It is more efficient th...
boost::heap::d_ary_heap< const cell_t *, boost::heap::mutable_< true >, boost::heap::arity< 2 >, boost::heap::compare< FMCompare< cell_t > > > d_ary_heap_t
Shorthand for heap type.
void update(const cell_t *c)
Updates the position of the cell in the heap. Its priority can increase or decrease.
void clear()
Deallocates heap memory.
size_t size() const
Returns current size of the heap.
FMDaryHeap(const size_t &n)
Creates a heap with n maximum elements.
unsigned int popMinIdx()
Pops index of the element with lowest value and removes it from the heap.
bool empty() const
Returns true if the heap is empty.
void push(const cell_t *c)
Pushes a new element into the heap.