Skip to main content

A python graph library implemented in Rust

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

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 is published on pypi so on x86_64 and i686 Linux systems or x86_64 on Mac OSX and Windows installing is as simple as running:

pip install retworkx

This will install a precompiled version of retworkx into your python environment.

However, if there are no precompiled binaries published for your system you’ll have to compile the code. The source package is also published on pypi so you can also run the above command to install it. However, there are 2 preconditions for this to work, first you need to have cargo/rustc nightly in your PATH. You can use rustup to make this step simpler. Secondly, you need to have setuptools-rust installed in your python environment. This can can be done by simply running:

pip install setuptools-rust

prior to running:

pip install retworkx

If you have rust nightly properly installed pip will compile retworkx for your local system and it should run just as the prebuilt binaries would.

Building from source

The first step for building retworkx from source is to clone it locally with:

git clone https://github.com/mtreinish/retworkx.git

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

which will install it the same way. Then retworkx in your local python environment. There are 2 things to note when doing this though, first if you try to run python from the repo root using this method it will not work as you expect. There is a name conflict in the repo root because of the local python package shim used in building the package. Simply run your python scripts or programs using retworkx outside of the repo root. The second issue is that any local changes you make to the rust code will not be reflected live in the python you’ll need to recompile the source by rerunning pip install to have any changes reflected in your python environment.

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
# The sole argument here can be any python object
root_node = my_dag.add_node("MyRoot")
# The second and third arguments can be any python object
my_dag.add_child(root_node, "AChild", ["EdgeData"])

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

retworkx-0.0.10-cp37-cp37m-win_amd64.whl (126.1 kB view details)

Uploaded CPython 3.7mWindows x86-64

retworkx-0.0.10-cp37-cp37m-manylinux1_x86_64.whl (742.2 kB view details)

Uploaded CPython 3.7m

retworkx-0.0.10-cp37-cp37m-manylinux1_i686.whl (783.6 kB view details)

Uploaded CPython 3.7m

retworkx-0.0.10-cp37-cp37m-macosx_10_6_intel.whl (166.7 kB view details)

Uploaded CPython 3.7mmacOS 10.6+ Intel (x86-64, i386)

retworkx-0.0.10-cp36-cp36m-win_amd64.whl (126.4 kB view details)

Uploaded CPython 3.6mWindows x86-64

retworkx-0.0.10-cp36-cp36m-manylinux1_x86_64.whl (742.5 kB view details)

Uploaded CPython 3.6m

retworkx-0.0.10-cp36-cp36m-manylinux1_i686.whl (784.2 kB view details)

Uploaded CPython 3.6m

retworkx-0.0.10-cp36-cp36m-macosx_10_6_intel.whl (166.9 kB view details)

Uploaded CPython 3.6mmacOS 10.6+ Intel (x86-64, i386)

retworkx-0.0.10-cp35-cp35m-win_amd64.whl (126.3 kB view details)

Uploaded CPython 3.5mWindows x86-64

retworkx-0.0.10-cp35-cp35m-manylinux1_x86_64.whl (742.5 kB view details)

Uploaded CPython 3.5m

retworkx-0.0.10-cp35-cp35m-manylinux1_i686.whl (784.3 kB view details)

Uploaded CPython 3.5m

retworkx-0.0.10-cp35-cp35m-macosx_10_6_intel.whl (166.9 kB view details)

Uploaded CPython 3.5mmacOS 10.6+ Intel (x86-64, i386)

File details

Details for the file retworkx-0.0.10-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: retworkx-0.0.10-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 126.1 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.36.0 CPython/2.7.16

File hashes

Hashes for retworkx-0.0.10-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 a34c91f8901d299b38e9e3ffc4e26d4ea872c22a238dd216d35f2b699a7a453e
MD5 3061fd240ee6a2f6dd92eec57e525644
BLAKE2b-256 92450ec21ad377a72175b08e36db4f6a753c894692ac1c6ffc0cd27a9fca6d34

See more details on using hashes here.

File details

Details for the file retworkx-0.0.10-cp37-cp37m-manylinux1_x86_64.whl.

File metadata

  • Download URL: retworkx-0.0.10-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 742.2 kB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.9.1 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.36.0 CPython/2.7.12

File hashes

Hashes for retworkx-0.0.10-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 a27d1720b910231e8b059d588ac79c4b727361d70a6a3e41c7a5ed9e5e1c95ea
MD5 bd5a6e24838ae6b9205f31c9878d5b68
BLAKE2b-256 3093fb2e07ce77ef72cf8c1b1d00563aa668a133743fc5fa94b632afc506bbc9

See more details on using hashes here.

File details

Details for the file retworkx-0.0.10-cp37-cp37m-manylinux1_i686.whl.

File metadata

  • Download URL: retworkx-0.0.10-cp37-cp37m-manylinux1_i686.whl
  • Upload date:
  • Size: 783.6 kB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.9.1 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.36.0 CPython/2.7.12

File hashes

Hashes for retworkx-0.0.10-cp37-cp37m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 f177e74975a24e774c445639c4d22d4bbba57f1bbed100620582046e8bd53179
MD5 3daec155d48b61e6bb7de138aad6ae13
BLAKE2b-256 3aff7438d65dd6b71335ba1911f9a49c193812446e2e88acd460cddd74bcf6cc

See more details on using hashes here.

File details

Details for the file retworkx-0.0.10-cp37-cp37m-macosx_10_6_intel.whl.

File metadata

  • Download URL: retworkx-0.0.10-cp37-cp37m-macosx_10_6_intel.whl
  • Upload date:
  • Size: 166.7 kB
  • Tags: CPython 3.7m, macOS 10.6+ Intel (x86-64, i386)
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.2.0 requests-toolbelt/0.9.1 tqdm/4.36.0 CPython/2.7.15

File hashes

Hashes for retworkx-0.0.10-cp37-cp37m-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 456efbc69a73842d280aae7f896ce45af4657f73e4412570f884c80d19321b6b
MD5 8fa57737256f94f228baa1f9845ab952
BLAKE2b-256 3f865c2cca6e31aef4bc61b0950491756d1bb9073ac3752b4657e740def07d0c

See more details on using hashes here.

File details

Details for the file retworkx-0.0.10-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: retworkx-0.0.10-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 126.4 kB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.36.0 CPython/2.7.16

File hashes

Hashes for retworkx-0.0.10-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 9783fbb5f9dd9eeb3a5cea677684ff146f53d1886789cdb58eb5b28b7515af7e
MD5 2c2e9381c9411c243456dc6709c2e5ce
BLAKE2b-256 35e676acad847df9860a4e1a2cd555b3e21de1d36d5075124de717adc60b82da

See more details on using hashes here.

File details

Details for the file retworkx-0.0.10-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

  • Download URL: retworkx-0.0.10-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 742.5 kB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.9.1 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.36.0 CPython/2.7.12

File hashes

Hashes for retworkx-0.0.10-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 dd180b474ce74f1b3593dfbfd56627a594d05773d80725b7d9fedf96eedaafae
MD5 76445d039917ebbb76af40f8eee29b7f
BLAKE2b-256 dafd7b3f8b8367813d40d188220b1419cf37c0f736c9aa7be20f4cfad52004f3

See more details on using hashes here.

File details

Details for the file retworkx-0.0.10-cp36-cp36m-manylinux1_i686.whl.

File metadata

  • Download URL: retworkx-0.0.10-cp36-cp36m-manylinux1_i686.whl
  • Upload date:
  • Size: 784.2 kB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.9.1 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.36.0 CPython/2.7.12

File hashes

Hashes for retworkx-0.0.10-cp36-cp36m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 8163be4c991a237e4bc45d9d4cd494b0db760f4d43ace0fa6dcd8866d5ef7d7b
MD5 d3eff42d804142e2ffb1832556900131
BLAKE2b-256 5d635e123448e2378d4b199b7421b6039acb1b300804e8f2bd91a9f1ad928faf

See more details on using hashes here.

File details

Details for the file retworkx-0.0.10-cp36-cp36m-macosx_10_6_intel.whl.

File metadata

  • Download URL: retworkx-0.0.10-cp36-cp36m-macosx_10_6_intel.whl
  • Upload date:
  • Size: 166.9 kB
  • Tags: CPython 3.6m, macOS 10.6+ Intel (x86-64, i386)
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.2.0 requests-toolbelt/0.9.1 tqdm/4.36.0 CPython/2.7.15

File hashes

Hashes for retworkx-0.0.10-cp36-cp36m-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 31ce135a4deb034d02b9081a67ffe6f7748eff2c08f52b454829b4acd167a974
MD5 3824e75e315b9b36310663ad190dc8e7
BLAKE2b-256 d3b7ea762f8bec2f51d2cd9b58ff266b81f4df7a934eff01a10783de2ac5f822

See more details on using hashes here.

File details

Details for the file retworkx-0.0.10-cp35-cp35m-win_amd64.whl.

File metadata

  • Download URL: retworkx-0.0.10-cp35-cp35m-win_amd64.whl
  • Upload date:
  • Size: 126.3 kB
  • Tags: CPython 3.5m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.36.0 CPython/2.7.16

File hashes

Hashes for retworkx-0.0.10-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 1a3cb6ac71621e9f40b3474125539b5dd7ad22bc2e387cc61b36494e4a3742ae
MD5 01b7187aa9b470c5187a662caaa63a4f
BLAKE2b-256 cd8dfa0596c0bbb59ba48660982c2abc1bbf4bc14e7b2ccaa26292b0c738490b

See more details on using hashes here.

File details

Details for the file retworkx-0.0.10-cp35-cp35m-manylinux1_x86_64.whl.

File metadata

  • Download URL: retworkx-0.0.10-cp35-cp35m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 742.5 kB
  • Tags: CPython 3.5m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.9.1 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.36.0 CPython/2.7.12

File hashes

Hashes for retworkx-0.0.10-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 62e4d085b1cad393c302adae3877b8e4cdb18fffc3eebbd1df8f76e2516f1e7d
MD5 1930717e0fef4f4fdb32d56331271172
BLAKE2b-256 fa6d0a933073ad01455e4286f7ed5fc449e835e0dab4eb6628e4c37850011ba0

See more details on using hashes here.

File details

Details for the file retworkx-0.0.10-cp35-cp35m-manylinux1_i686.whl.

File metadata

  • Download URL: retworkx-0.0.10-cp35-cp35m-manylinux1_i686.whl
  • Upload date:
  • Size: 784.3 kB
  • Tags: CPython 3.5m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.9.1 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.36.0 CPython/2.7.12

File hashes

Hashes for retworkx-0.0.10-cp35-cp35m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 3baa2bd8e3a29f1fef2027c782b08b07a4d6fb0dce2f0cdb584043fe169fc253
MD5 8e669a182b7c484d4d03ca27b2aa5954
BLAKE2b-256 bee766dc0bdd2c6ad0bc92cc4c8b0820e71d821e1d97b2708097517ce40f0fc1

See more details on using hashes here.

File details

Details for the file retworkx-0.0.10-cp35-cp35m-macosx_10_6_intel.whl.

File metadata

  • Download URL: retworkx-0.0.10-cp35-cp35m-macosx_10_6_intel.whl
  • Upload date:
  • Size: 166.9 kB
  • Tags: CPython 3.5m, macOS 10.6+ Intel (x86-64, i386)
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.2.0 requests-toolbelt/0.9.1 tqdm/4.36.0 CPython/2.7.15

File hashes

Hashes for retworkx-0.0.10-cp35-cp35m-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 881af650438b32a7f4a0ffffe0693324aef4d2d21558f05b537f3dab2a7e4b6a
MD5 5d1e84b2909fac67a90fe40d276681f1
BLAKE2b-256 3291db334b39b159251f1b888fec7435c5fbd3b2190b928679661cd7f4ce9dc7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page