Skip to content

Edgewise ​

Edgewise is a personal project exploring parallel graph algorithms in C++20. It compares sequential and parallel implementations, examining how synchronization, graph storage and work distribution affect performance.

So far, I’ve implemented sequential and parallel breadth-first search (BFS) and PageRank. I plan to explore parallel connected components (CC) for undirected graphs later.

BFS results ​

I wrote my parallel BFS in versions, each introducing a new possible optimization. Details of which are discussed in the BFS tutorials.

A brief summary of the parallel versions implemented:

  • V1: protect vertex discovery with a shared mutex.
  • V2: replace discovery mutex with atomic compare-and-swap.
  • V3: reuse worker threads across all BFS layers.
  • V4: assemble the next frontier in parallel.

Table for BFS results ​

VerticesEdges (undirected)SequentialParallelWorkersSpeedup
200,000800,00017.02 ms12.30 ms81.38×
500,0002,000,00072.15 ms25.92 ms102.78×
1,000,0004,000,000178.31 ms47.63 ms163.74×
1,500,0006,000,000287.47 ms69.71 ms144.12×

Table notes

  • Sequential: single-threaded BFS using CSR storage.
  • Parallel: Version 3 of my parallel implementation, which currently performs the best.
  • Graphs are undirected, connected, and generated from a binary-tree backbone, with random extra edges using a random seed 67.
  • Measurements use a Release build on an 8-core, 16-logical-processor laptop.

Times are medians of five measured repetitions after warm-up. For each graph, the parallel result uses the worker count with the lowest median. Speedup is the sequential median divided by the parallel median. See the benchmark methodology and results for details.

PageRank results ​

The parallel implementation splits vertices among persistent workers and combines their results after each round.

VerticesEdges (undirected)SequentialParallelWorkersSpeedup
200,000800,00071.83 ms27.79 ms82.58×
500,0002,000,000274.67 ms77.23 ms63.56×
1,000,0004,000,0001,464.01 ms344.65 ms144.25×
1,500,0006,000,0001,885.92 ms429.22 ms164.39×

Times are medians of five measured runs after warm-up, using the worker count with the lowest parallel median. These use the same generated graph sizes and laptop as the BFS results above. Both PageRank implementations use damping 0.85, tolerance 1e-10, and an iteration limit of 100.

See the PageRank results for measurement details and parallel implementation for the code.

Explore ​