Master’s course · 2026
Parallel graph analysis in Rust
BFS, connected components and PageRank on a graph with a million nodes and 10 million edges, up to 8.2× faster on 8 threads.
What it is
Breadth-first search, weakly connected components and PageRank, each in a sequential and a parallel version, on graphs of up to a million nodes and 10 million edges. The use case is diagnosing faults in a network.
How it works
Rayon handles the data parallelism. Connected components use a lock-free union-find: threads merge sets with an atomic compare-and-swap, and path halving keeps the trees flat.
Result
On 8 threads, on a random graph with a million nodes and 10 million edges, connected components ran 8.2× faster than the sequential version, PageRank 3.3× and breadth-first search 2.7×.
The hard part
The connected-components speed-up is above linear: 8.2× on 8 threads, and already 3.1× on 2. With perfect scaling, 8 threads give 8× and 2 give 2×, so the threads alone can’t explain it.
The reason is that the two versions don’t use the same union-find:
Sequential
Recursive path compression, with union by rank.
Parallel
Lock-free, with compare-and-swap and path halving.
So part of the 8.2× comes from the leaner union-find, not only from the threads.