Metadata-Version: 2.4
Name: nx-rustworkx
Version: 0.2.0
Summary: A NetworkX backend that dispatches selected algorithms to rustworkx.
Author-email: Ville Vesilehto <ville@vesilehto.fi>
License-Expression: BSD-3-Clause
Project-URL: Homepage, https://ville.dev/nx-rustworkx/
Project-URL: Documentation, https://ville.dev/nx-rustworkx/
Project-URL: Bug Tracker, https://github.com/thevilledev/nx-rustworkx/issues
Project-URL: Source Code, https://github.com/thevilledev/nx-rustworkx
Project-URL: Release Notes, https://github.com/thevilledev/nx-rustworkx/releases
Project-URL: PyPI, https://pypi.org/project/nx-rustworkx/
Keywords: networkx,graphs,algorithms,rustworkx,backend
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: networkx>=3.4
Requires-Dist: rustworkx>=0.18
Provides-Extra: test
Requires-Dist: pytest>=7.2; extra == "test"
Requires-Dist: scipy>=1.10; extra == "test"
Provides-Extra: bench
Requires-Dist: pytest>=7.2; extra == "bench"
Dynamic: license-file

# nx-rustworkx

A [NetworkX](https://networkx.org/) 3.x backend that accelerates selected graph
algorithms with [rustworkx](https://www.rustworkx.org/).

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

```bash
pip install nx-rustworkx
```

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

## Use

Set rustworkx as a preferred backend:

```bash
NETWORKX_BACKEND_PRIORITY=rustworkx python your_script.py
```

Or configure it in Python:

```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](https://ville.dev/nx-rustworkx/usage.html) covers enabling
generator dispatch.

## Documentation

Usage, configuration, supported algorithms, caveats, and benchmarks:
[ville.dev/nx-rustworkx](https://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](https://ville.dev/nx-rustworkx/algorithms.html) lists
the exact behavior and fallback conditions.

## Development

```bash
uv sync --extra test
uv run pytest tests
```

See the [development guide](https://ville.dev/nx-rustworkx/development.html) for
the full test, lint, benchmark, and architecture notes.

## License

BSD-3-Clause.
