Skip to main content

nx-rustworkx

A NetworkX 3.x backend that accelerates selected graph algorithms with rustworkx.

Keep import networkx as nx. nx-rustworkx converts an nx.Graph, runs the rustworkx kernel, and remaps the result to the original node IDs. Unsupported calls stay on NetworkX.

Install

pip install nx-rustworkx

Requires Python 3.10+, NetworkX 3.4+, and rustworkx 0.18+.

Use

Set rustworkx as a preferred backend:

NETWORKX_BACKEND_PRIORITY=rustworkx python your_script.py

Or configure it in Python:

import networkx as nx

G = nx.erdos_renyi_graph(2_000, 0.01, seed=1)
nx.config.backend_priority = ["rustworkx"]

scores = nx.betweenness_centrality(G)

The backend implements 111 algorithms. Its measured cutoffs keep small or conversion-heavy calls on NetworkX; backend="rustworkx" explicitly tries the rustworkx implementation.

Generators such as nx.path_graph and nx.gnp_random_graph can construct rustworkx-backed graphs directly, so whole pipelines skip conversion; the usage guide covers enabling generator dispatch.

Documentation

Usage, configuration, supported algorithms, caveats, and benchmarks: ville.dev/nx-rustworkx

Limits

  • Simple graphs and digraphs only; no multigraphs.
  • No custom weight callables.
  • The rustworkx-backed graph object does not implement drawing or I/O.
  • Some valid results may differ in ordering or floating-point rounding.
  • Seeded random generators reproduce NetworkX's graphs unless native_seeded_generators is enabled; the opt-in draws from rustworkx's RNG, so the same seed gives a different, equally valid graph.

The algorithm reference lists the exact behavior and fallback conditions.

Development

uv sync --extra test
uv run pytest tests

See the development guide for the full test, lint, benchmark, and architecture notes.

License

BSD-3-Clause.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nx_rustworkx-0.2.0.tar.gz (67.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nx_rustworkx-0.2.0-py3-none-any.whl (55.7 kB view details)

Uploaded Python 3

File details

Details for the file nx_rustworkx-0.2.0.tar.gz.

File metadata

  • Download URL: nx_rustworkx-0.2.0.tar.gz
  • Upload date:
  • Size: 67.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for nx_rustworkx-0.2.0.tar.gz
Algorithm Hash digest
SHA256 0150225e56a27e4311325f951152df84423dd91c906feff6df61094625b15e7d
MD5 13ac3a3d68a11c38220392f6d9a2450c
BLAKE2b-256 d9dbe07b6ed790d18ecdb500066d077015048f88f0d8c18f414ae6e8da183238

See more details on using hashes here.

Provenance

The following attestation bundles were made for nx_rustworkx-0.2.0.tar.gz:

Publisher: publish.yml on thevilledev/nx-rustworkx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nx_rustworkx-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: nx_rustworkx-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 55.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for nx_rustworkx-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a672db5ec69cc6158037b7e5ee19e80f05b026ceee0892287d4ae7dc46591fd2
MD5 05ae3480282a5310cefa35e861b8f903
BLAKE2b-256 2741e51247b87f822bcbf2de28cd52efe3622debed8566355f8857968c8b8d88

See more details on using hashes here.

Provenance

The following attestation bundles were made for nx_rustworkx-0.2.0-py3-none-any.whl:

Publisher: publish.yml on thevilledev/nx-rustworkx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.2.1

2 files

This release

0.2.0 This release

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page