Skip to content

Commit

Permalink
sssp comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sbeamer committed Aug 18, 2015
1 parent 0c737ff commit 4b58f36
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ Author: Scott Beamer
Will return comp array labelling each vertex with a connected component ID
This CC implementation makes use of the Shiloach-Vishkin[2] algorithm with
implementation optimizations from Bader et al.[1].
This CC implementation makes use of the Shiloach-Vishkin [2] algorithm with
implementation optimizations from Bader et al. [1].
[1] David A Bader, Guojing Cong, and John Feo. "On the architectural
requirements for efficient execution of graph algorithms." International
Expand Down
35 changes: 33 additions & 2 deletions sssp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,43 @@
#include "pvector.h"
#include "timer.h"


/*
GAP Benchmark Suite
Kernel: Single-source Shortest Paths (SSSP)
Author: Scott Beamer
Returns array of distances for all vertices from given source vertex
This SSSP implementation makes use of the ∆-stepping algorithm [1]. The type
used for weights and distances (WeightT) is typedefined in benchmark.h. The
delta parameter (-d) should be set for each input graph.
The bins of width delta are actually all thread-local and of type std::vector
so they can grow but are otherwise capacity-proportional. The currently
processed bin makes use of the Bucket object and is generated right before it
is used. Each iteration is done in two phases separated by barriers. In the
first phase, the current shared bin is processed by all threads. As they
find vertices whose distance they are able to improve, they add them to their
thread-local bins. During this phase, each thread also votes on what the next
bin should be (smallest non-empty bin). In the next phase, each thread moves
their selected thread-local bin into the shared bin.
Once a vertex is added to a bin, it is not removed, even if its distance is
later updated and it now appears in a lower bin. We find ignoring vertices if
their current distance is less than the min distance for the bin to remove
enough redundant work that this is faster than removing the vertex from older
bins.
[1] Ulrich Meyer and Peter Sanders. "δ-stepping: a parallelizable shortest path
algorithm." Journal of Algorithms, 49(1):114–152, 2003.
*/


using namespace std;

const WeightT kDistInf = numeric_limits<WeightT>::max()/2;


// reduces barriers down to 2
pvector<WeightT> DeltaStep(const WGraph &g, NodeID source, WeightT delta) {
Timer t;
pvector<WeightT> dist(g.num_nodes(), kDistInf);
Expand Down

0 comments on commit 4b58f36

Please sign in to comment.