Algorithms

The backend implements 111 NetworkX algorithms plus constructors and generators for rustworkx-backed graphs. Anything outside this list stays on NetworkX when the input is still an ordinary NetworkX graph.

Supported NetworkX functions
AreaFunctions
Centralitybetweenness_centrality, closeness_centrality, degree_centrality, edge_betweenness_centrality, eigenvector_centrality, group_betweenness_centrality, group_closeness_centrality, group_degree_centrality, hits, in_degree_centrality, katz_centrality, katz_centrality_numpy, out_degree_centrality
Link analysispagerank
Shortest pathsshortest_path, shortest_path_length, dijkstra_path, dijkstra_path_length, bellman_ford_path, bellman_ford_path_length, bidirectional_shortest_path, has_path, all_shortest_paths
Single sourcesingle_source_dijkstra, single_source_dijkstra_path, single_source_dijkstra_path_length, single_source_bellman_ford, single_source_bellman_ford_path, single_source_bellman_ford_path_length, single_source_shortest_path, single_source_shortest_path_length, single_source_all_shortest_paths, single_target_shortest_path, single_target_shortest_path_length
All pairsall_pairs_dijkstra, all_pairs_dijkstra_path, all_pairs_dijkstra_path_length, all_pairs_bellman_ford_path, all_pairs_bellman_ford_path_length, all_pairs_shortest_path, all_pairs_shortest_path_length, floyd_warshall, floyd_warshall_numpy, floyd_warshall_predecessor_and_distance, average_shortest_path_length
Heuristic searchastar_path, astar_path_length
Negative cyclesnegative_edge_cycle, find_negative_cycle
DAGis_directed_acyclic_graph, topological_sort, topological_generations, ancestors, descendants, descendants_at_distance, dag_longest_path, dag_longest_path_length, transitive_reduction, immediate_dominators, dominance_frontiers
Traversaldfs_edges, bfs_layers
Distance measureseccentricity, diameter, radius, center, periphery
Connectivityis_connected, is_weakly_connected, is_strongly_connected, is_semiconnected, connected_components, weakly_connected_components, strongly_connected_components, number_connected_components, number_weakly_connected_components, number_strongly_connected_components, node_connected_component, articulation_points, bridges, biconnected_components, condensation, stoer_wagner
Cycles and coressimple_cycles, cycle_basis, find_cycle, chain_decomposition, core_number
Structureis_bipartite, bipartite.color, is_planar, isolates, number_of_isolates, transitivity
Matching and coloringmax_weight_matching, is_matching, is_maximal_matching, greedy_color
Treesminimum_spanning_tree, minimum_spanning_edges, steiner_tree, metric_closure
Operatorscomplement, cartesian_product, tensor_product, line_graph
Simple pathsall_simple_paths
Isomorphismis_isomorphic, vf2pp_is_isomorphic, vf2pp_isomorphism, vf2pp_all_isomorphisms
ConstructionGraph, DiGraph, MultiGraph, MultiDiGraph, empty_graph, from_edgelist
Generatorspath_graph, cycle_graph, star_graph, complete_graph, barbell_graph, lollipop_graph, binomial_tree, full_rary_tree, karate_club_graph, grid_2d_graph, hexagonal_lattice_graph
Random generatorsgnp_random_graph, fast_gnp_random_graph, gnm_random_graph, dense_gnm_random_graph, random_regular_graph, stochastic_block_model, random_geometric_graph, barabasi_albert_graph, bipartite.random_graph

Automatic-dispatch policy

Explicit backend="rustworkx" calls can reach every implementation above. Automatic backend priority declines 24 functions for which conversion or result remapping is usually slower than NetworkX:

Single source-target forms of shortest_path are declined automatically whether weighted or not: NetworkX answers a pair with a bidirectional search that visits a fraction of the graph. The goal-stopped length kernels have no such handicap, so weighted single-pair shortest_path_length, dijkstra_path_length, and bellman_ford_path_length keep dispatching — measured 1.2–9× faster across path, dense, and road-network shapes (benches/bench_single_pair.py).

Generators have no size cutoff: there is no conversion cost to amortize, and the dispatcher never consults should_run for them. Random generators with an explicit seed fall back to NetworkX's sampler by default; see seeded random generators.

The eccentricity family computes rustworkx's all-pairs distance matrix, which is quadratic in memory. Automatic dispatch declines it past ~4096 nodes (a ~134 MB matrix); backend="rustworkx" runs anyway, accepting the memory cost. A single-node eccentricity request computes per-source lengths instead and has no such gate.

Compatibility limits

The backend rejects argument shapes it cannot honor:

Valid differences

When an answer is not unique, rustworkx may return a different valid ordering or structure. This applies to topological order, longest DAG paths, cycle bases, chain decompositions, greedy colorings, isomorphism mappings, the order inside a BFS layer, some predecessor maps, negative-cycle starting nodes, and minimum spanning forests with tied weights. PageRank, HITS, Katz, and eigenvector centrality may differ slightly through floating-point ordering.

Random generators sample with rustworkx's RNG when nx.config.backends.rustworkx.native_seeded_generators is enabled, so a seeded call draws a different — equally valid — graph than NetworkX's for the same seed. The same seed then reproduces the same graph for a pinned rustworkx version. Deterministic generators always match NetworkX exactly.

Graph-returning algorithms return real NetworkX graphs; generators return rustworkx-backed graphs. Backend metadata publishes per-function caveats, so help(nx.function_name) shows the relevant constraints after installation.