Benchmarks

Backend speed is an end-to-end question. These results include conversion from NetworkX, the rustworkx kernel, and remapping to the original node IDs. Both implementations receive the same graphs and seeds.

Dispatch follows the measurements. At 2,000 nodes, 89 of 111 supported functions are faster end to end. Automatic backend priority declines the 24 functions where NetworkX keeps winning.

Real projects

The strongest evidence is other people's code. The runners in benches/external/ drop the backend into real NetworkX projects without changing their application code and compare against stock NetworkX on the same machine. Every timed call is verified to have actually dispatched, and the committed RESULTS.md holds the full tables, including the honest losses.

Highlights from the latest run (4-CPU Linux container)
Workload NetworkX nx-rustworkx Speedup
City street network (OSMnx MultiDiGraph, parallel ways included), weighted closeness centrality358 s2.6 s136×
Same network, unweighted betweenness centrality115 s1.5 s78×
Same network, 200 point-to-point travel-time routes8.0 s2.3 s3.4×
nx-parallel benchmark suite, all-pairs Bellman–Ford lengths (n=400)18.7 s0.44 s42×
NetworkX's bundled benchmark suite, strongly connected components (n=10,000)32 ms4 ms

A good fit: CPU-heavy whole-graph algorithms on graphs from a few hundred nodes up — centralities, all-pairs shortest paths, components, isomorphism — and repeat-call pipelines, where the one-time conversion is cached. Not the tool: graphs below the 200-node/400-edge floor, one-off linear-time calls where conversion costs more than NetworkX's answer, SciPy-backed algorithms such as pagerank, callable weights, and code that walks G.adj directly — a backend can only accelerate the NetworkX API.

Parity suite

bench_parity.py runs one representative call for every supported function. It fails if a materially slower function would still be selected automatically.

python benches/bench_parity.py --nodes 2000
Sample at n=2,000 on a 4-core Linux VM
Function rustworkx (s) NetworkX (s) Speedup
is_isomorphic0.022813.42589×
bridges0.000580.134232×
katz_centrality0.00550.39372×
group_betweenness_centrality0.37825.6368×
transitivity0.00240.14963×
betweenness_centrality0.31316.9854×
floyd_warshall0.35413.3038×
max_weight_matching0.1674.0925×
all_pairs_dijkstra_path_length0.0761.7623×
eigenvector_centrality0.00420.06816×
minimum_spanning_tree0.01490.0664.4×
core_number0.00760.01181.6×

These figures describe one machine and workload, not a universal ranking. Run the scripts on your own graph shapes before tuning cutoffs.

Conversion cost

bench_centrality.py separates conversion from the betweenness-centrality kernel.

python benches/bench_centrality.py
betweenness_centrality on gnp_random_graph(n, p, seed=1)
n m convert (s) kernel (s) total (s) NetworkX (s) speedup
2002,0350.000310.00190.00480.06714×
2,00020,0500.00430.190.308.428×
20,000200,4730.0985052

The 2,000-node row is the public milestone graph. The NetworkX run at 20,000 nodes is omitted because the pure-Python Brandes computation is impractical there.

Read the result