ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
ADS::PriorityFrontier< Q > Class Template Reference

a priority queue of the nodes [see PriorityQueue.h] as \( S \): the priority of a node its distance or, if the priority is a pair, the pair ( distance , node ), which breaks the ties by the names of the nodes, so that any priority queue extracts the same nodes in the same order. More...

#include <ADS/graph/ShortestPaths.h>

Public member functions

 PriorityFrontier (Q &q, int n)
 \( S \) on the queue \( q \), empty, for the nodes \( [ 0 , n ) \)
template<class D>
void add (int v, const D &d, bool)
 \( v \) into \( S \) at the distance \( d \)
int extract (void)
 a node out of \( S \); the stale copies of a lazy queue skipped
template<class D>
void update (int v, const D &d)
 the priority of \( v \), already in \( S \), falls to \( d \)
bool empty (void) const
 whether \( S \) is empty; a lazy queue may still hold stale copies

Static public member functions

template<class D>
static priority_t< Q > key (int v, const D &d)
 the priority of \( v \) at the distance \( d \)

Detailed description

template<FrontierQueue Q>
class ADS::PriorityFrontier< Q >

a priority queue of the nodes [see PriorityQueue.h] as \( S \): the priority of a node its distance or, if the priority is a pair, the pair ( distance , node ), which breaks the ties by the names of the nodes, so that any priority queue extracts the same nodes in the same order.

A queue without a Priority (std::priority_queue, Boost.Heap) holds the pairs ( distance , node ) themselves, which must then be its items, in the order that puts the least pair on top (std::greater). The fall of a distance is queue_decrease() on the handle of the node if the queue lowers its keys natively, a new insertion of the node otherwise (decrease_key_of() of Capabilities.h): the copy of least priority of a node is then the one of its distance, which comes out first, and the others, which come out after it, are skipped. The queue is reached only by the customization points of PriorityQueue.h, so that a queue of another library needs no wrapper

Constructor and destructor documentation

◆ PriorityFrontier()

template<FrontierQueue Q>
ADS::PriorityFrontier< Q >::PriorityFrontier ( Q & q,
int n )
inline

\( S \) on the queue \( q \), empty, for the nodes \( [ 0 , n ) \)

Precondition
\( q \) is empty, \( n \ge 0 \)

Member function documentation

◆ add()

template<FrontierQueue Q>
template<class D>
void ADS::PriorityFrontier< Q >::add ( int v,
const D & d,
bool  )
inline

\( v \) into \( S \) at the distance \( d \)

◆ empty()

template<FrontierQueue Q>
bool ADS::PriorityFrontier< Q >::empty ( void ) const
inlinenodiscard

whether \( S \) is empty; a lazy queue may still hold stale copies

◆ extract()

template<FrontierQueue Q>
int ADS::PriorityFrontier< Q >::extract ( void )
inline

a node out of \( S \); the stale copies of a lazy queue skipped

◆ key()

template<FrontierQueue Q>
template<class D>
priority_t< Q > ADS::PriorityFrontier< Q >::key ( int v,
const D & d )
inlinestatic

the priority of \( v \) at the distance \( d \)

◆ update()

template<FrontierQueue Q>
template<class D>
void ADS::PriorityFrontier< Q >::update ( int v,
const D & d )
inline

the priority of \( v \), already in \( S \), falls to \( d \)


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