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 Mac OSX systems 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.7.tar.gz (6.3 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.7-cp37-cp37m-win_amd64.whl (120.4 kB view details)

Uploaded CPython 3.7mWindows x86-64

retworkx-0.0.7-cp37-cp37m-manylinux1_x86_64.whl (506.5 kB view details)

Uploaded CPython 3.7m

retworkx-0.0.7-cp37-cp37m-manylinux1_i686.whl (532.0 kB view details)

Uploaded CPython 3.7m

retworkx-0.0.7-cp37-cp37m-macosx_10_6_intel.whl (159.8 kB view details)

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

retworkx-0.0.7-cp36-cp36m-win_amd64.whl (120.6 kB view details)

Uploaded CPython 3.6mWindows x86-64

retworkx-0.0.7-cp36-cp36m-manylinux1_x86_64.whl (506.7 kB view details)

Uploaded CPython 3.6m

retworkx-0.0.7-cp36-cp36m-manylinux1_i686.whl (532.4 kB view details)

Uploaded CPython 3.6m

retworkx-0.0.7-cp36-cp36m-macosx_10_6_intel.whl (160.1 kB view details)

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

retworkx-0.0.7-cp35-cp35m-win_amd64.whl (120.6 kB view details)

Uploaded CPython 3.5mWindows x86-64

retworkx-0.0.7-cp35-cp35m-manylinux1_x86_64.whl (506.7 kB view details)

Uploaded CPython 3.5m

retworkx-0.0.7-cp35-cp35m-manylinux1_i686.whl (532.3 kB view details)

Uploaded CPython 3.5m

retworkx-0.0.7-cp35-cp35m-macosx_10_6_intel.whl (160.1 kB view details)

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

File details

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

File metadata

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

File hashes

Hashes for retworkx-0.0.7.tar.gz
Algorithm Hash digest
SHA256 4436db1b21c23f91a837d0cc550a84fc21e1fcd9d64bfd41c79476d988d6156c
MD5 b536501a13ba313adb81c65417ffec44
BLAKE2b-256 48b1a101c0718fc887e54d82299779e809eaeeb21c8cc24fe1e35531d90e45e6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: retworkx-0.0.7-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 120.4 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.7-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 d5c833714b1cc5dda86ff6393a2f4f11e629d602fc66a4e79078f465f3c0153e
MD5 40e71f29aa25c5aa246ea9f7b4891d7e
BLAKE2b-256 9e148b0f17b4bd4114482a2e71859e248deba52640a83cbae9971b9472fe244f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: retworkx-0.0.7-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 506.5 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.7-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 7ffb706f54a9b4c522c1638bd599be794f7be84b08d1465773785fff498fccc3
MD5 8783697236bedc654ddf4c058c4beca8
BLAKE2b-256 ba1fa146ab3becde6b3ad4d2458b03d8aeeaca590cc837ea46003db2bf5a738c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: retworkx-0.0.7-cp37-cp37m-manylinux1_i686.whl
  • Upload date:
  • Size: 532.0 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.7-cp37-cp37m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 a6292b29986d50d0e4e44286ffdb5eaf196ddf093d859a4b43e0a678466d4ea6
MD5 f0971699a885b5b5547e2d0889f0797d
BLAKE2b-256 d6666c3cb8b68e0ea749fc91919c9d019088ab6cba5b5212df5843f2e7af3d68

See more details on using hashes here.

File details

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

File metadata

  • Download URL: retworkx-0.0.7-cp37-cp37m-macosx_10_6_intel.whl
  • Upload date:
  • Size: 159.8 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.7-cp37-cp37m-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 c8698f599a78e19cb3fb7b00ee3dd76377d72a062b5afa573b587d98b0429d2c
MD5 f42a4c4b51e21ac6870fd2a43620c399
BLAKE2b-256 88c7209a5858fc84a210ec63d639fd0114248b74772919f1c6e33e2ca9d66d5b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: retworkx-0.0.7-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 120.6 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.7-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 502654cc33c6a38727f67a293e4a9c8f0d262d0af4a29c8a0257879a74f212ee
MD5 42316b8bed8b4379844bd71c7462b028
BLAKE2b-256 f1a1875eefe8001d5a14f11ee06fd56fc46aeaf5aabd8c0c2f3cd488dc654c76

See more details on using hashes here.

File details

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

File metadata

  • Download URL: retworkx-0.0.7-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 506.7 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.7-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 0aa65fff81a7544fe83a7100fd504b19b759e6120d854ddde02b1dcd9ad46809
MD5 9176b4271300e393fb1a1ed67a36b176
BLAKE2b-256 50fac14ade502f9b809edd104885aa96e1798ea29f48ee8d90bfa33bc7bf876e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: retworkx-0.0.7-cp36-cp36m-manylinux1_i686.whl
  • Upload date:
  • Size: 532.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.7-cp36-cp36m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 ff374a4ac10652ce51381d307a6964b84ad82929f4c66397d5c295ea40701dbc
MD5 592a3efd08faed9a47a5239dba4c0dc7
BLAKE2b-256 4ef31ee6c38b602815ee20657b41c9a2adfd324315adbd503407d44c536e2a14

See more details on using hashes here.

File details

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

File metadata

  • Download URL: retworkx-0.0.7-cp36-cp36m-macosx_10_6_intel.whl
  • Upload date:
  • Size: 160.1 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.7-cp36-cp36m-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 bc7cc41abdd4a7d10c27973944f816de76071a1d32569b25eb502d1af6cd95b4
MD5 f19099023a680cde5e42e4a38b7ea7dc
BLAKE2b-256 f6b1e0b5e36045cd7112929fa67d271fa7c7ce85a75637dc3821e725e91a2990

See more details on using hashes here.

File details

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

File metadata

  • Download URL: retworkx-0.0.7-cp35-cp35m-win_amd64.whl
  • Upload date:
  • Size: 120.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.7-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 60213beaf3e9cbfdec57d2161c1c39c91b6fd5c793b151694ce0dee683f79425
MD5 e28d3ad2476e8ee580b9afb5e2237fc8
BLAKE2b-256 5b737901e7da9b46d685602776c9df4fd7735942002c706710688f387b76d468

See more details on using hashes here.

File details

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

File metadata

  • Download URL: retworkx-0.0.7-cp35-cp35m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 506.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.7-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 611aae1244fc4f287178bc922d1defa48b2ad4880f13160b6792a16247eecaa0
MD5 2cb94491d1954b23ef292a3d9299d5f9
BLAKE2b-256 c99b35467b3c375f5711cb312b790870e28950b4c93903097b32e6456099c69f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: retworkx-0.0.7-cp35-cp35m-manylinux1_i686.whl
  • Upload date:
  • Size: 532.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.7-cp35-cp35m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 5877763a7c4f67118168aee48ea91ca71bc47864e19d707d009997b99f7826c8
MD5 1d5fdd4ab16a514eadf602bdff7a775c
BLAKE2b-256 9a4d21d6628d012b466cdfe6fa99c7a7e6da016a6d84818db40b2b6a6a7dd8a5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: retworkx-0.0.7-cp35-cp35m-macosx_10_6_intel.whl
  • Upload date:
  • Size: 160.1 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.7-cp35-cp35m-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 303356ca4b96124884cfa8a30c9fddcd3399e2a673f9a181932acd0eb920ba61
MD5 46f2a684bff5310194ef3e977e4a8995
BLAKE2b-256 30afcd4d917861ec5e8a2a831750c930ca6150571490b3c2f714eb9349c01e3f

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