Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

ogdf::PrioritizedMapQueue< E, P, C, Impl, HashFunc > Class Template Reference

Prioritized queue interface wrapper for heaps. More...

#include <ogdf/basic/PriorityQueue.h>

+ Inheritance diagram for ogdf::PrioritizedMapQueue< E, P, C, Impl, HashFunc >:

Public Member Functions

 PrioritizedMapQueue (const C &cmp=C(), int initialSize=128)
 Creates a new queue with the given comparer. More...
 
- Public Member Functions inherited from ogdf::pq_internal::PrioritizedArrayQueueBase< E, P, std::less< P >, PairingHeap, HashArray< E, PrioritizedQueue< E, P, std::less< P >, PairingHeap >::Handle, DefHashFunc< E > > >
void clear ()
 Removes all elements from this queue. More...
 
bool contains (const E &element) const
 Returns whether this queue contains that key. More...
 
void decrease (const E &element, const P &priority)
 Decreases the priority of the given element. More...
 
void pop ()
 Removes the topmost element from the queue. More...
 
const P & priority (const E &element) const
 
void push (const E &element, const P &priority)
 Adds a new element to the queue. More...
 
- Public Member Functions inherited from ogdf::pq_internal::PrioritizedQueue< E, P, std::less< P >, PairingHeap >
 PrioritizedQueue (const std::less< P > &cmp=std::less< P >(), int initialSize=128)
 
void decrease (Handle pos, const P &priority)
 
Handle push (const E &element, const P &priority)
 Pushes a new element with the respective priority to the queue. More...
 
const E & topElement () const
 Returns the topmost element in the queue. More...
 
const P & topPriority () const
 Returns the priority of the topmost element in this queue. More...
 
- Public Member Functions inherited from ogdf::PriorityQueue< T, C, Impl >
 PriorityQueue (const C &cmp=C(), int initialSize=128)
 Creates empty priority queue. More...
 
 PriorityQueue (const PriorityQueue &other)
 Copy constructor. More...
 
template<class InputIt >
 PriorityQueue (InputIt first, InputIt last, const C &cmp=C())
 Creates priority queue with contents of the given range. More...
 
 PriorityQueue (PriorityQueue &&other)
 Move constructor. More...
 
 PriorityQueue (std::initializer_list< value_type > init, const C &cmp=C())
 Creates priority queue with contents of the given initializer list. More...
 
 ~PriorityQueue ()
 Destroys the underlying data structure. More...
 
void clear ()
 Removes all the entries from the queue. More...
 
const C & comparator () const
 Returns the comparator used for ordering elements. More...
 
void decrease (handle pos, const T &value)
 Decreases value of the element specified by handle to value. More...
 
bool empty () const
 Checks whether the queue is empty. More...
 
void merge (PriorityQueue &other)
 Merges in enqueued values of other queue. More...
 
PriorityQueueoperator= (PriorityQueue other)
 Copy and move assignment. More...
 
PriorityQueueoperator= (std::initializer_list< value_type > ilist)
 Assigns the priority queue contents of the given initializer list. More...
 
void pop ()
 Removes the top element from the heap. More...
 
handle push (const value_type &value)
 Inserts a new element with given value into the queue. More...
 
template<class InputIt >
void push (InputIt first, InputIt last)
 Inserts new elements specified by the given range. More...
 
void push (std::initializer_list< value_type > ilist)
 Inserts new elements specified by the given initializer list. More...
 
size_type size () const
 Returns the number of enqueued elements. More...
 
void swap (PriorityQueue &other)
 Swaps the contents. More...
 
const T & top () const
 Returns reference to the top element in the queue. More...
 
const T & value (handle pos) const
 Returns the priority of that handle. More...
 

Private Types

using CustomHashArray = HashArray< E, typename PrioritizedQueue< E, P, C, Impl >::Handle, HashFunc< E > >
 
using SuperQueue = pq_internal::PrioritizedArrayQueueBase< E, P, C, Impl, CustomHashArray >
 

Additional Inherited Members

- Public Types inherited from ogdf::pq_internal::PrioritizedQueue< E, P, std::less< P >, PairingHeap >
using Handle = typename SuperQueue::handle
 The type of handle for accessing the elements of this queue. More...
 
- Public Types inherited from ogdf::PriorityQueue< T, C, Impl >
using const_reference = const value_type &
 
using handle = typename SpecImpl::Handle
 
using reference = value_type &
 
using size_type = std::size_t
 
using value_type = T
 
- Protected Types inherited from ogdf::pq_internal::PrioritizedArrayQueueBase< E, P, std::less< P >, PairingHeap, HashArray< E, PrioritizedQueue< E, P, std::less< P >, PairingHeap >::Handle, DefHashFunc< E > > >
using Handle = typename PrioritizedQueue< E, P, std::less< P >, PairingHeap >::Handle
 
using SuperQueue = PrioritizedQueue< E, P, std::less< P >, PairingHeap >
 
- Protected Member Functions inherited from ogdf::pq_internal::PrioritizedArrayQueueBase< E, P, std::less< P >, PairingHeap, HashArray< E, PrioritizedQueue< E, P, std::less< P >, PairingHeap >::Handle, DefHashFunc< E > > >
 PrioritizedArrayQueueBase (const std::less< P > &cmp, int initialSize, const HashArray< E, PrioritizedQueue< E, P, std::less< P >, PairingHeap >::Handle, DefHashFunc< E > > &map)
 
- Protected Attributes inherited from ogdf::pq_internal::PrioritizedArrayQueueBase< E, P, std::less< P >, PairingHeap, HashArray< E, PrioritizedQueue< E, P, std::less< P >, PairingHeap >::Handle, DefHashFunc< E > > >
HashArray< E, PrioritizedQueue< E, P, std::less< P >, PairingHeap >::Handle, DefHashFunc< E > > m_handles
 

Detailed Description

template<typename E, typename P, class C = std::less<P>, template< typename, class > class Impl = PairingHeap, template< typename > class HashFunc = DefHashFunc>
class ogdf::PrioritizedMapQueue< E, P, C, Impl, HashFunc >

Prioritized queue interface wrapper for heaps.

Much like PrioritizedQueue but each inserted element is treated as a key. As such, the same element might not be inserted twice. This interface does not require the user to keep track of handlers for decreasing the priority of the respective elements.

If node (or edge) is specified as the type of keys to be stored, a ogdf::NodeArray (or ogdf::EdgeArray) is used internally. These types should be chosen whenever possible.

This queue does not support merge operations.

Template Parameters
EDenotes value type of inserted elements.
PDenotes the type of priority.
CDenotes the comparison functor for comparing priorities.
ImplDenotes the underlying heap class.
HashFuncThe hashing function to be used if a ogdf::HashArray is used internally.

Definition at line 409 of file PriorityQueue.h.

Member Typedef Documentation

◆ CustomHashArray

template<typename E , typename P , class C = std::less<P>, template< typename, class > class Impl = PairingHeap, template< typename > class HashFunc = DefHashFunc>
using ogdf::PrioritizedMapQueue< E, P, C, Impl, HashFunc >::CustomHashArray = HashArray<E, typename PrioritizedQueue<E, P, C, Impl>::Handle, HashFunc<E> >
private

Definition at line 414 of file PriorityQueue.h.

◆ SuperQueue

template<typename E , typename P , class C = std::less<P>, template< typename, class > class Impl = PairingHeap, template< typename > class HashFunc = DefHashFunc>
using ogdf::PrioritizedMapQueue< E, P, C, Impl, HashFunc >::SuperQueue = pq_internal::PrioritizedArrayQueueBase<E, P, C, Impl, CustomHashArray>
private

Definition at line 415 of file PriorityQueue.h.

Constructor & Destructor Documentation

◆ PrioritizedMapQueue()

template<typename E , typename P , class C = std::less<P>, template< typename, class > class Impl = PairingHeap, template< typename > class HashFunc = DefHashFunc>
ogdf::PrioritizedMapQueue< E, P, C, Impl, HashFunc >::PrioritizedMapQueue ( const C &  cmp = C(),
int  initialSize = 128 
)
inline

Creates a new queue with the given comparer.

Parameters
cmpThe comparer to be used.
initialSizeThe initial capacity preference (ignored if not supported by underlying heap).

Definition at line 424 of file PriorityQueue.h.


The documentation for this class was generated from the following file: