PageRank · Structured Parallelism
DATA PARALLELISM · TASK PARALLELISM · visualizer

One worker, then four — watch the speedup happen.

Both views run the exact same PageRank algorithm on the exact same 15-node web graph. The left lane uses one worker walking every node, one at a time. The right lane splits the work across four threads running in parallel. The timers, the iteration count, and the live PageRank scores are all computed from the real algorithm — only the animation is sped up. This is a visual illustration of the idea; the measured benchmarks are in the project README.

220ms
Iteration 0 / 20
Idle
Sequential 1 WORKER
0.00s
Iteration 0/20 0/15 nodes
Parallel 4 WORKERS
0.00s
Iteration 0/20 0/15 nodes (parallel)
Live Speedup
—×
Press play to start the race. When both lanes finish, you'll see how many times faster four parallel workers were.
Sequential
— s
Parallel
— s

Live PageRank Scores

Top 5 pages, updated every iteration. Both lanes converge to the same values.

Sequential

One worker visits every node, in order. Each iteration touches all 15 — wait for the previous one before starting the next. O(n) per iter.

Data parallelism

Nodes are split into 4 chunks. Each chunk goes to its own thread. Threads run the same code ((1-d)/n + d·A[chunk]@ranks) on different rows, then sync.

The fix

Pin BLAS to 1 thread, and create the ThreadPoolExecutor once outside the iteration loop. Without these two changes, NumPy's own threads and ours competed for the same cores and the parallel version ran slower than sequential.