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 Distribution

retworkx-0.0.8.tar.gz (6.6 kB view details)

Uploaded Source

Built Distributions

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

retworkx-0.0.8-cp37-cp37m-win_amd64.whl (121.2 kB view details)

Uploaded CPython 3.7mWindows x86-64

retworkx-0.0.8-cp37-cp37m-manylinux1_x86_64.whl (507.2 kB view details)

Uploaded CPython 3.7m

retworkx-0.0.8-cp37-cp37m-manylinux1_i686.whl (532.9 kB view details)

Uploaded CPython 3.7m

retworkx-0.0.8-cp37-cp37m-macosx_10_6_intel.whl (160.7 kB view details)

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

retworkx-0.0.8-cp36-cp36m-win_amd64.whl (121.5 kB view details)

Uploaded CPython 3.6mWindows x86-64

retworkx-0.0.8-cp36-cp36m-manylinux1_x86_64.whl (507.4 kB view details)

Uploaded CPython 3.6m

retworkx-0.0.8-cp36-cp36m-manylinux1_i686.whl (533.2 kB view details)

Uploaded CPython 3.6m

retworkx-0.0.8-cp36-cp36m-macosx_10_6_intel.whl (160.8 kB view details)

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

retworkx-0.0.8-cp35-cp35m-win_amd64.whl (121.6 kB view details)

Uploaded CPython 3.5mWindows x86-64

retworkx-0.0.8-cp35-cp35m-manylinux1_x86_64.whl (507.3 kB view details)

Uploaded CPython 3.5m

retworkx-0.0.8-cp35-cp35m-manylinux1_i686.whl (532.7 kB view details)

Uploaded CPython 3.5m

retworkx-0.0.8-cp35-cp35m-macosx_10_6_intel.whl (160.7 kB view details)

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

File details

Details for the file retworkx-0.0.8.tar.gz.

File metadata

  • Download URL: retworkx-0.0.8.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.3

File hashes

Hashes for retworkx-0.0.8.tar.gz
Algorithm Hash digest
SHA256 c2446ca07ca993ce3b99b933d3a4c8b2a9e2773dbd9ca243c7b52070701d1076
MD5 7847b8251599fcf2d25bbff548caaade
BLAKE2b-256 f70b84db551987a55746d308d828d879ece08460f39235f4d0b9102fcc401439

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for retworkx-0.0.8-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 f912f0cadb31e87fa083fd355616c1e44ce6d43e5e061b26364b8299616d1627
MD5 1ba47a5e3bdf95525c57955986145ff9
BLAKE2b-256 05e513f7e17d40e33956382fa402f241b2c5b36aa5ee9737761018b586be22de

See more details on using hashes here.

File details

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

File metadata

  • Download URL: retworkx-0.0.8-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 507.2 kB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/2.7.6

File hashes

Hashes for retworkx-0.0.8-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 f6043129839d39398a0ae189840e77c5a131544f4fb43fd43c492a30978595c0
MD5 7acb63ee00a9b84ac06360f8395c3679
BLAKE2b-256 3ad4cc6616dbf44dc427d36f5a8cb399374633870b1b14196363807a35cec9e4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: retworkx-0.0.8-cp37-cp37m-manylinux1_i686.whl
  • Upload date:
  • Size: 532.9 kB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/2.7.6

File hashes

Hashes for retworkx-0.0.8-cp37-cp37m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 bdd1b7370da1e09136288293902a0f468a5e4acf2d5d3bd3e5a300369d830140
MD5 4eb5c7ef476684a6cdec33ecdb417212
BLAKE2b-256 bdc80b1f1a4ccc16f41441a07ecb8c2e48dda30416f2c54e972155ab66f46e80

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for retworkx-0.0.8-cp37-cp37m-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 df4c9925388ec479b31b5b01c7cb95c90998a181169a71b6aaa630e3a2936c90
MD5 a4697f14c09d59e9c2ded6ca27d8b663
BLAKE2b-256 a43181fdfbdd4b1ad138bf9eee70e0cf8e87081dae48141b5d369ac337e9e3be

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for retworkx-0.0.8-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 f178cb0e8e12d57beecb49aa1e55a5d3d1fb7b90d820f6c443e8d982dec70a0d
MD5 3538935c5380f6b484d92313adbf761b
BLAKE2b-256 d3807a49714039f548e3c14df0ba603a85d3b122ea3482e1917bfa74a6e4bed2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: retworkx-0.0.8-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 507.4 kB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/2.7.6

File hashes

Hashes for retworkx-0.0.8-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 de53e6ffb989748fc9a5700deb55616c495ff3896f49040633ddd890636dad26
MD5 e68632b4ecd94d19567a78921e3081c6
BLAKE2b-256 66e2c4ecb50fa0d8bf7c07d2eaf1f9f32b49ad7ee26acd84ffde7fa5acd58dcb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: retworkx-0.0.8-cp36-cp36m-manylinux1_i686.whl
  • Upload date:
  • Size: 533.2 kB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/2.7.6

File hashes

Hashes for retworkx-0.0.8-cp36-cp36m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 eb74a30ebcc3547b91ff6def04762557e1ba4a8ba82bf2b61a7e0567d5677924
MD5 b5a1c227143ca14d905d46c20eeac4d7
BLAKE2b-256 549ba8b3cdac62ab5eaa558bfef5abc97acb9bcc4d1a6be9da2ad658518ecf0f

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for retworkx-0.0.8-cp36-cp36m-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 3a04c878988426f78f5947b103d34047827ff9d64dd94e41896b3f5f80518d10
MD5 3d061538439cd1d7842385426c6e754b
BLAKE2b-256 fbd14a8812e49a4bd21e1e9b54ffec607856691140057dcce3bbe24dd502e153

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for retworkx-0.0.8-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 70c147d9419f74bcf6ef79a6b6a7a2eb0325ff0509181a06ad40dc8c50567e8a
MD5 cffebc7b0ba76266094049dad1efeba9
BLAKE2b-256 088d4780d8bfe6397c7adc180705c19628bba09706afae8b3d16a9909ba24a72

See more details on using hashes here.

File details

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

File metadata

  • Download URL: retworkx-0.0.8-cp35-cp35m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 507.3 kB
  • Tags: CPython 3.5m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/2.7.6

File hashes

Hashes for retworkx-0.0.8-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 5aea3ad8cbd81e803de4529026328c52a1adb8581b39d1eae4f189b4de58033d
MD5 53a819c65ba927935f323870476ec091
BLAKE2b-256 9932a1a00294d0a143ff5805e0b0f8f014fd545a071b04abc262e1a44132164a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: retworkx-0.0.8-cp35-cp35m-manylinux1_i686.whl
  • Upload date:
  • Size: 532.7 kB
  • Tags: CPython 3.5m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/2.7.6

File hashes

Hashes for retworkx-0.0.8-cp35-cp35m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 03dab0ceeef2f2276582bc23ba12cac866cfe4859d41969a32311ad6a7aa7975
MD5 8e3eb0ae008b897fdead616adb746c35
BLAKE2b-256 f5e61f0475bc2e9a5c593f2d0d2d2b70ddddf563aaf3e5cbd6e1582a435ddd4e

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for retworkx-0.0.8-cp35-cp35m-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 a7719a690ed84083327e4f4dfffd78d692aa7c56567fe65b1d39f882c3a712a9
MD5 940120bc31c9ade29f421f895f94a7ae
BLAKE2b-256 6304148b9e9aa2633134d4115010000972ab7eb738d99f63972fedba209bc5a7

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