|
ADS
Algorithms and Data Structures
|
The parallel shortest paths from a node \( s \) of a GRAPH whose costs are not negative, beyond the book, on the threads of an executor [see Executor.h]: the stepping algorithms, which relax in parallel all the active nodes whose distance is below a threshold, with the distances of the algorithm of Dijkstra [see ShortestPaths.h], value for value. More...
#include "ADS/Contract.h"#include "ADS/graph/Graph.h"#include "ADS/graph/ShortestPaths.h"#include "ADS/graph/StaticGraph.h"#include "ADS/parallel/Executor.h"#include <algorithm>#include <atomic>#include <cstddef>#include <cstdint>#include <vector>#include "ADS/parallel/impl/ParallelShortestPaths.tpp"Go to the source code of this file.
Namespaces | |
| namespace | ADS |
Functions | |
| template<Executor E, Graph G> | |
| std::vector< typename G::Weight > | ADS::deltaStepping (E &ex, const G &g, int s, typename G::Weight delta) |
| the distances from \( s \) by the \( \Delta \)-stepping of Meyer and Sanders, infinity() for the nodes not reached and for the unused names, in a vector of g.bound() places | |
| template<Executor E, Graph G> | |
| std::vector< typename G::Weight > | ADS::rhoStepping (E &ex, const G &g, int s, std::size_t rho=std::size_t(1)<< 20) |
| the distances from \( s \) by the \( \rho \)-stepping of Dong, Gu, Sun and Zhang, infinity() for the nodes not reached and for the unused names, in a vector of g.bound() places | |
The parallel shortest paths from a node \( s \) of a GRAPH whose costs are not negative, beyond the book, on the threads of an executor [see Executor.h]: the stepping algorithms, which relax in parallel all the active nodes whose distance is below a threshold, with the distances of the algorithm of Dijkstra [see ShortestPaths.h], value for value.
Both relax the arcs of nodes in parallel, each improvement of a head by an atomic minimum ( \( d( u ) \gets \min\{ d( u ) , d( v ) + w( v , u ) \} \) by a compare-and-swap), and differ in the nodes that a step relaxes:
The threads of deltaStepping() meet at barriers for the whole run, which a thread joins when the executor starts its call: the barrier counts it at its next release and never waits for a call not started, so that the run ends on any executor, one that runs the calls one after the other included. The distances do not depend on the executor nor on the order of the relaxations: they are the least fixed point of \( d( u ) = \min_{( v , u )} d( v ) + w( v , u ) \) with \( d( s ) = 0 \), where each sum is the one of the computer (for the floating points too, since a sum with a cost that is not negative does not decrease, the property on which the algorithm of Dijkstra rests; see Lemma 5 of Shortest paths by steps).
Each step costs work proportional to the arcs of its nodes and depth proportional to the arcs of one node, a chunk of the frontier and the fusion of one thread; a node is relaxed once with Dijkstra, more often here, as many times as its distance falls after it was relaxed, which a smaller \( \Delta \) or \( \rho \) makes rarer at the price of more steps (the trade of the stepping algorithms; see Shortest paths by steps).
The contracts [see Contract.h]: \( s \) is a node, the costs are not negative, \( \Delta > 0 \) and \( \rho \ge 1 \); the distances are sums in the type of the costs, not checked for overflow, as in ShortestPaths.h, and infinity() marks the nodes not reached. The functions are defined in ParallelShortestPaths.tpp.