Guide/Start here
Why a Port, Not a Wrapper?
3 min readFrom the README
On this page 1
There are several existing approaches to "faster NetworkX." Each has tradeoffs the FrankenNetworkX design rejects.
| Approach | What it does | Why we didn't choose it |
|---|---|---|
| Subclassing or monkey-patching nx graphs with C/Cython adjacency | Replace specific hot loops with native code, leave the rest in Python. | Doesn't move the cost: nested Python dicts still dominate memory and cache behavior. Algorithm-level work happens in pure Python. GIL stays held. |
| Wrapping a separate Rust/C++ graph engine and copying data in/out | Convert nx graphs into a foreign representation, run algorithms there, convert results back. | The conversion is the entire workload for short-running algorithms. Attribute fidelity gets lost. Tie-break behavior diverges. Algorithm coverage is sparse. |
| Rewriting in Rust with a "Rust-idiomatic" API | Build a clean-slate Rust graph library with its own type system. | Users have to rewrite. The behavioral oracle (NetworkX) becomes invisible. Iteration order drift makes results non-portable. |
| FrankenNetworkX | Port algorithms into native Rust, preserve NetworkX-observable behavior on implemented paths, and measure every declared import/signature path against the pinned reference. | This is the design target, not a completed full-surface claim: the live FeatureUniverse records present, partial, missing, n/a, and reasoned exclusions. |
The discipline difference is enforced by tooling, not goodwill:
- The Python parity suite (
tests/python/, about 1,100 files) compares fnx-vs-nx call by call across thousands of fixtures, including iteration order, exception class, and error wording. The DSR quality run executes the whole suite in guarded shards (scripts/run_python_parity_suite.py; 68,318 passed and 0 failed on 2026-09-24). - The generated coverage matrix under
docs/is compared on every DSR quality run, so__all__drift, a signature change, or an export that gains a directly visible NetworkX route fails it. - The CGSE complexity-witness ledger gives every algorithm execution a reproducible length-prefixed Blake3 receipt, so behavioral parity can be regression-locked, not just spot-checked.
Comparison with other "faster graphs"
| Library | API style | Drop-in for nx? | Tie-break parity? | Coverage | Notes |
|---|---|---|---|---|---|
| NetworkX | nx.* | n/a | n/a (reference) | comprehensive | Pure Python; the behavioral oracle for everything below. |
igraph (python-igraph) |
Graph class with its own methods |
no; different method names, different return types | no; internal node IDs are integer indices, often re-numbered | strong for the algorithms it supports | Mature, fast, C core. Different conceptual model: vertices are dense integer indices, not arbitrary labels. |
| graph-tool | Graph with vertex/edge property maps |
no; C++/Python hybrid API | no | strong for analytics + statistics | Boost-backed, very fast, but requires a custom build pipeline (no PyPI wheel). |
| rustworkx | PyGraph/PyDiGraph with integer node IDs |
partial; explicit conversion API | no; integer-index based | growing | High-quality Rust core; intentionally not a drop-in replacement. |
| graspologic / networkx-cuda / cugraph | various, often GPU-backed | partial; mostly nx-shaped but algorithm coverage varies widely | varies | varies | Often optimize the inner loop of specific algorithms (PageRank, BFS, connected components) but require additional toolchains (CUDA, conda channels). |
| FrankenNetworkX | fnx.* compatibility layer + backend dispatch |
near-complete; 100% strict import/signature coverage and every test of NetworkX's own suite that runs in backend mode passing, with fallback on unsupported paths | scoped; explicit CGSE TieBreakPolicy on owned paths |
4,129 present / 0 partial / 0 missing applicable paths; 476 backend-dispatchable algorithms | Pre-built ABI3 wheels. The generated FeatureUniverse states every gap and exclusion. |
The honest summary: if the only thing you need is "PageRank on a huge graph as fast as possible" and you don't care about API shape or tie-break semantics, igraph or graph-tool or a GPU library may beat fnx on raw throughput for that single call. If you have an existing NetworkX codebase and you want it to just work without rewriting and without subtle behavior changes, fnx is built for that case.