Skip to main content

A python graph library implemented in Rust

Project description

retworkx is a rust graph library interface to python3. For right now it’s scope is as an experiment in being a potential replacement for qiskit-terra’s networkx usage (hence the name). The scope might grow or change over time, but to start it’s just about building a DAG and operating on it with the performance and safety that Rust provides. It is also a personal exercise in learning how to interface rust with python.

Installing retworkx

retworkx uses PyO3 and setuptools-rust to build the python interface. Unfortunately this means you need to use nightly rust because PyO3 only works with nightly at this point. You can use rustup to install rust nightly.

Once you have nightly rust and cargo installed you can easily install retworkx into your python environment using pip. Once you have a local clone of the repo you can install retworkx into your python env with:

pip install .

Assuming your current working directory is the root of the repo. Otherwise you can run:

pip install $PATH_TO_REPO_ROOT

Using retworkx

Once you have retworkx installed you can use it by importing retworkx. All the functions and the PyDAG class are off the root of the package. For example, building a DAG and adding 2 nodes with an edge between them would be:

import retworkx

my_dag = retworkx.PyDAG()
# add_node(), add_child(), and add_parent() return the node index
root_node = my_dag.add_node("MyRoot")
my_dag.add_child(root_node, "AChild")

Project details


Download files

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

Files for retworkx, version 0.0.3
Filename, size File type Python version Upload date Hashes
Filename, size retworkx-0.0.3-cp35-cp35m-macosx_10_6_intel.whl (158.0 kB) File type Wheel Python version cp35 Upload date Hashes View
Filename, size retworkx-0.0.3-cp35-cp35m-manylinux1_i686.whl (527.1 kB) File type Wheel Python version cp35 Upload date Hashes View
Filename, size retworkx-0.0.3-cp35-cp35m-manylinux1_x86_64.whl (501.4 kB) File type Wheel Python version cp35 Upload date Hashes View
Filename, size retworkx-0.0.3-cp36-cp36m-macosx_10_6_intel.whl (158.1 kB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size retworkx-0.0.3-cp36-cp36m-manylinux1_i686.whl (527.3 kB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size retworkx-0.0.3-cp36-cp36m-manylinux1_x86_64.whl (501.4 kB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size retworkx-0.0.3-cp37-cp37m-macosx_10_6_intel.whl (157.8 kB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size retworkx-0.0.3-cp37-cp37m-manylinux1_i686.whl (526.7 kB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size retworkx-0.0.3-cp37-cp37m-manylinux1_x86_64.whl (501.2 kB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size retworkx-0.0.3.tar.gz (5.2 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page