ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
Parallel.h

The algorithms of LEMON on the threads of ADS, beyond the book (see Interoperation with LEMON). More...

Files

file  ADS/interop/lemon/Parallel.h
 The algorithms of LEMON on the threads of ADS, beyond the book (see Interoperation with LEMON):

Functions

template<class H = void, Executor E, class GR, class LM>
std::vector< std::vector< typename LM::Value > > ADS::lemon_interop::dijkstraFrom (E &ex, const GR &g, const LM &l, const std::vector< typename GR::Node > &S)
 the distances from each node of \( S \) in the digraph \( g \) of the lengths \( l \), by one run of the Dijkstra of LEMON per source on the threads of \( \mathit{ex} \): the vector of each source, by the ids of the nodes, infinity() for those not reached [see ShortestPaths.h]
template<Executor E, class GR, class CM, class Item = typename CM::Key>
std::vector< std::pair< Item, typename CM::Value > > ADS::lemon_interop::sortedArcs (E &ex, const GR &g, const CM &c)
 the pairs ( item , cost ) of the items Item of \( g \), the edges of a graph by default, in the order of the costs of \( c \), sorted on the threads of \( \mathit{ex} \), for lemon::kruskal( g , S , t )

Detailed description

The algorithms of LEMON on the threads of ADS, beyond the book (see Interoperation with LEMON).

Function documentation

◆ dijkstraFrom()

template<class H = void, Executor E, class GR, class LM>
std::vector< std::vector< typename LM::Value > > ADS::lemon_interop::dijkstraFrom ( E & ex,
const GR & g,
const LM & l,
const std::vector< typename GR::Node > & S )
nodiscard

the distances from each node of \( S \) in the digraph \( g \) of the lengths \( l \), by one run of the Dijkstra of LEMON per source on the threads of \( \mathit{ex} \): the vector of each source, by the ids of the nodes, infinity() for those not reached [see ShortestPaths.h]

In pseudocode (beyond the book):

\[\class{pseudocode}{\begin{array}{r@{\quad}l} 1 & \textbf{function}\ \mathrm{dijkstraFrom}( \mathit{ex} , g , l , S ) \cr 2 & \quad \mathit{ex}.\mathrm{bulk}( |S| , i \mapsto \text{a run of } \mathrm{Dijkstra}( g , l ) \text{ from } S[ i ] \text{ on maps} \text{ of its own, its distances in } D[ i ] ) \cr 3 & \quad \textbf{return}\ D \end{array}} \]

Precondition
every length is not negative, \( g \) does not change meanwhile

◆ sortedArcs()

template<Executor E, class GR, class CM, class Item = typename CM::Key>
std::vector< std::pair< Item, typename CM::Value > > ADS::lemon_interop::sortedArcs ( E & ex,
const GR & g,
const CM & c )
nodiscard

the pairs ( item , cost ) of the items Item of \( g \), the edges of a graph by default, in the order of the costs of \( c \), sorted on the threads of \( \mathit{ex} \), for lemon::kruskal( g , S , t )