46#ifndef __ADS_interop_lemon_Parallel
47 #define __ADS_interop_lemon_Parallel
54#if ! __has_include( <lemon/core.h> )
55 #error "the interoperation with LEMON needs the headers of LEMON"
64#include <lemon/bits/traits.h>
65#include <lemon/core.h>
66#include <lemon/dijkstra.h>
102template<
class H =
void , Executor E ,
class GR ,
class LM >
103[[nodiscard]] std::vector< std::vector< typename LM::Value > >
105 const std::vector< typename GR::Node > & S )
107 using V =
typename LM::Value;
114 typename ::lemon::Dijkstra< GR , LM >::template SetPredMap< PM >::Create::
115 template SetDistMap< DM >::Create::template SetHeap< Heap , CR >::Create;
116 std::vector< std::vector< V > > R( S.size() );
117 ex.bulk( S.size() , [ & ]( std::size_t i ) {
120 PM pm( g , ::lemon::INVALID );
123 d.predMap( pm ).distMap( dm ).heap( h , cr );
125 std::vector< V > r( std::size_t( g.maxNodeId() + 1 ) , infinity< V >() );
126 for( typename GR::NodeIt v( g ) ; v != ::lemon::INVALID ; ++v )
128 r[ std::size_t( g.id( v ) ) ] = d.dist( v );
129 R[ i ] = std::move( r );
141template< Executor E ,
class GR ,
class CM ,
class Item =
typename CM::Key >
142[[nodiscard]] std::vector< std::pair< Item , typename CM::Value > >
145 using It = typename ::lemon::ItemSetTraits< GR , Item >::ItemIt;
146 std::vector< std::pair< Item , typename CM::Value > > S;
147 for( It x( g ) ; x != ::lemon::INVALID ; ++x )
148 S.emplace_back( x , c[ x ] );
149 ADS::sort( ex , S , [](
const auto & a ,
const auto & b ) {
150 return( a.second < b.second );
The layer of execution of the parallel algorithms of ADS, beyond the book: an executor runs the calls...
The heaps of ADS as heaps of LEMON, beyond the book: models of the concept lemon::concepts::Heap< PR ...
The maps of LEMON on the structures of ADS, beyond the book: models of the concepts ReadMap,...
The parallel sorts, beyond the book: sort( ex , A , less ) and stableSort( ex , A ,...
The shortest paths of chapter 11 from a node of an oriented GRAPH whose edges have a cost [see Grap...
an IndexedDaryHeap of ADS as a heap of LEMON, on the cross-reference map IM of the caller
Definition Heaps.h:128
a ReferenceMap of LEMON by the ids of the items of a graph, on an array of its own,...
Definition Maps.h:96
std::vector< std::vector< typename LM::Value > > dijkstraFrom(E &ex, const GR &g, const LM &l, const std::vector< typename GR::Node > &S)
the distances from each node of in the digraph of the lengths , by one run of the Dijkstra of LEMON...
Definition Parallel.h:104
std::vector< std::pair< Item, typename CM::Value > > sortedArcs(E &ex, const GR &g, const CM &c)
the pairs ( item , cost ) of the items Item of , the edges of a graph by default, in the order of the...
Definition Parallel.h:143
void sort(E &ex, Store &&A, C less=C())
the vector sorted by less on the threads of ex, not necessarily stable