{"id":13478047,"url":"https://github.com/Qiskit/rustworkx","last_synced_at":"2025-03-27T07:30:41.574Z","repository":{"id":37025805,"uuid":"186025444","full_name":"Qiskit/rustworkx","owner":"Qiskit","description":"A high performance Python graph library implemented in Rust.","archived":false,"fork":false,"pushed_at":"2025-03-26T01:44:31.000Z","size":38066,"stargazers_count":1268,"open_issues_count":119,"forks_count":171,"subscribers_count":14,"default_branch":"main","last_synced_at":"2025-03-26T22:00:42.512Z","etag":null,"topics":["dag","graph","graph-theory","python","rust"],"latest_commit_sha":null,"homepage":"https://www.rustworkx.org","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Qiskit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":"CITATION.bib","codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-10T17:09:02.000Z","updated_at":"2025-03-26T18:16:35.000Z","dependencies_parsed_at":"2023-10-14T18:23:27.736Z","dependency_job_id":"5ade2ceb-9675-4a47-9da2-9a39ea0064d8","html_url":"https://github.com/Qiskit/rustworkx","commit_stats":{"total_commits":612,"total_committers":34,"mean_commits":18.0,"dds":"0.36111111111111116","last_synced_commit":"e51fcccb53519154fe234fd41c37b22c9bfdf322"},"previous_names":["qiskit/retworkx"],"tags_count":41,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Qiskit%2Frustworkx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Qiskit%2Frustworkx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Qiskit%2Frustworkx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Qiskit%2Frustworkx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Qiskit","download_url":"https://codeload.github.com/Qiskit/rustworkx/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245802194,"owners_count":20674605,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dag","graph","graph-theory","python","rust"],"created_at":"2024-07-31T16:01:51.756Z","updated_at":"2025-03-27T07:30:41.559Z","avatar_url":"https://github.com/Qiskit.png","language":"Rust","readme":"# rustworkx\n\n[![License](https://img.shields.io/github/license/Qiskit/rustworkx.svg?style=popout-square)](https://opensource.org/licenses/Apache-2.0)\n![Build Status](https://github.com/Qiskit/rustworkx/actions/workflows/main.yml/badge.svg?branch=main)\n[![Build Status](https://img.shields.io/travis/com/Qiskit/rustworkx/main.svg?style=popout-square)](https://travis-ci.com/Qiskit/rustworkx)\n[![](https://img.shields.io/github/release/Qiskit/rustworkx.svg?style=popout-square)](https://github.com/Qiskit/rustworkx/releases)\n[![](https://img.shields.io/pypi/dm/rustworkx.svg?style=popout-square)](https://pypi.org/project/rustworkx/)\n[![Coverage Status](https://coveralls.io/repos/github/Qiskit/rustworkx/badge.svg?branch=main)](https://coveralls.io/github/Qiskit/rustworkx?branch=main)\n[![Minimum rustc 1.79](https://img.shields.io/badge/rustc-1.79+-blue.svg)](https://rust-lang.github.io/rfcs/2495-min-rust-version.html)\n[![DOI](https://joss.theoj.org/papers/10.21105/joss.03968/status.svg)](https://doi.org/10.21105/joss.03968)\n[![arXiv](https://img.shields.io/badge/arXiv-2110.15221-b31b1b.svg)](https://arxiv.org/abs/2110.15221)\n[![Zenodo](https://img.shields.io/badge/Zenodo-10.5281%2Fzenodo.5879859-blue)](https://doi.org/10.5281/zenodo.5879859)\n\n  - You can see the full rendered docs at:\n    \u003chttps://www.rustworkx.org/\u003e\n\nA high-performance, general-purpose graph library for Python, written in Rust.\n\n## Usage\n\nOnce installed, simply import `rustworkx`.\nAll graph classes and top-level functions are accessible with a single import.\nTo illustrate this, the following example calculates the shortest path\nbetween two nodes `A` and `C` in an undirected graph.\n\n```python3\nimport rustworkx\n\n# Rustworkx's undirected graph type.\ngraph = rustworkx.PyGraph()\n\n# Each time add node is called, it returns a new node index\na = graph.add_node(\"A\")\nb = graph.add_node(\"B\")\nc = graph.add_node(\"C\")\n\n# add_edges_from takes tuples of node indices and weights,\n# and returns edge indices\ngraph.add_edges_from([(a, b, 1.5), (a, c, 5.0), (b, c, 2.5)])\n\n# Returns the path A -\u003e B -\u003e C\nrustworkx.dijkstra_shortest_paths(graph, a, c, weight_fn=float)\n```\n\n## Installing rustworkx\n\nrustworkx is published on [PyPI](https://pypi.org/project/rustworkx/) so on x86\\_64, i686, ppc64le, s390x, and\naarch64 Linux systems, x86\\_64 on Mac OSX, and 32 and 64 bit Windows\ninstalling is as simple as running:\n\n```bash\npip install rustworkx\n```\n\nThis will install a precompiled version of rustworkx into your Python\nenvironment.\n\n### Installing on a platform without precompiled binaries\n\nIf there are no precompiled binaries published for your system you'll have to\nbuild the package from source. However, to be able to build the package\nfrom the published source package you need to have Rust \u003e= 1.70 installed (and\nalso [cargo](https://doc.rust-lang.org/cargo/) which is normally included with\nrust) You can use [rustup](https://rustup.rs/) (a cross platform installer for\nrust) to make this simpler, or rely on\n[other installation methods](https://forge.rust-lang.org/infra/other-installation-methods.html).\nA source package is also published on pypi, so you still can also run the above\n`pip` command to install it. Once you have rust properly installed, running:\n\n```bash\npip install rustworkx\n```\n\nwill build rustworkx for your local system from the source package and install\nit just as it would if there was a prebuilt binary available.\n\n\u003e [!NOTE]  \n\u003e To build from source you will need to ensure you have pip \u003e=19.0.0\ninstalled, which supports PEP-517, or that you have manually installed\n`setuptools-rust` prior to running `pip install rustworkx`. If you receive an\nerror about `setuptools-rust` not being found you should upgrade pip with\n`pip install -U pip` or manually install `setuptools-rust` with\n`pip install setuptools-rust` and try again.\n\n### Optional dependencies\n\nIf you're planning to use the `rustworkx.visualization` module you will need to\ninstall optional dependencies to use the functions. The matplotlib based drawer\nfunction `rustworkx.visualization.mpl_draw` requires that the\n[matplotlib](https://matplotlib.org/) library is installed. This can be\ninstalled with `pip install matplotlib` or when you're installing rustworkx with\n`pip install 'rustworkx[mpl]'`. If you're going to use the graphviz based drawer\nfunction `rustworkx.visualization.graphviz_drawer` first you will need to install\ngraphviz, instructions for this can be found here:\nhttps://graphviz.org/download/#executable-packages. Then you\nwill need to install the [pillow](https://python-pillow.org/) Python library.\nThis can be done either with `pip install pillow` or when installing rustworkx\nwith `pip install 'rustworkx[graphviz]'`.\n\nIf you would like to install all the optional Python dependencies when you\ninstall rustworkx you can use `pip install 'rustworkx[all]'` to do this.\n\n## Authors and Citation\n\nrustworkx is the work of [many people](https://github.com/Qiskit/rustworkx/graphs/contributors) who contribute\nto the project at different levels. If you use rustworkx in your research, please cite our\n[paper](https://doi.org/10.21105/joss.03968) as per the included [BibTeX file](CITATION.bib).\n\n## Community\n\nBesides Github interactions (such as opening issues) there are two locations\navailable to talk to other rustworkx users and developers. The first is a\npublic Slack channel in the Qiskit workspace,\n[#rustworkx](https://qiskit.slack.com/messages/rustworkx/). You can join the\nQiskit Slack workspace [here](http://ibm.co/joinqiskitslack). Additionally,\nthere is an IRC channel `#rustworkx` on the [OFTC IRC network](https://www.oftc.net/)\n\n## Building from source\n\nThe first step for building rustworkx from source is to clone it locally\nwith:\n\n```bash\ngit clone https://github.com/Qiskit/rustworkx.git\n```\n\nrustworkx uses [PyO3](https://github.com/pyo3/pyo3) and\n[setuptools-rust](https://github.com/PyO3/setuptools-rust) to build the\npython interface, which enables using standard python tooling to work. So,\nassuming you have rust installed, you can easily install rustworkx into your\npython environment using `pip`. Once you have a local clone of the repo, change\nyour current working directory to the root of the repo. Then, you can install\nrustworkx into your python env with:\n\n```bash\npip install .\n```\n\nAssuming your current working directory is still the root of the repo.\nOtherwise you can run:\n\n```bash\npip install $PATH_TO_REPO_ROOT\n```\n\nwhich will install it the same way. Then rustworkx is installed in your\nlocal python environment. There are 2 things to note when doing this\nthough, first if you try to run python from the repo root using this\nmethod it will not work as you expect. There is a name conflict in the\nrepo root because of the local python package shim used in building the\npackage. Simply run your python scripts or programs using rustworkx\noutside of the repo root. The second issue is that any local changes you\nmake to the rust code will not be reflected live in your python environment,\nyou'll need to recompile rustworkx by rerunning `pip install` to have any\nchanges reflected in your python environment.\n\n### Develop Mode\n\nIf you'd like to build rustworkx in debug mode and use an interactive debugger\nwhile working on a change you can use `python setup.py develop` to build\nand install rustworkx in develop mode. This will build rustworkx without\noptimizations and include debuginfo which can be handy for debugging. Do note\nthat installing rustworkx this way will be significantly slower then using\n`pip install` and should only be used for debugging/development.\n\n\u003e [!TIP]\n\u003e It's worth noting that `pip install -e` does not work, as it will link the python\npackaging shim to your python environment but not build the rustworkx binary. If\nyou want to build rustworkx in debug mode you have to use\n`python setup.py develop`.\n\n## Project history\n\nRustworkx was originally called retworkx and was created initially to be\na replacement for [Qiskit](https://www.ibm.com/quantum/qiskit)'s previous (and current)\nNetworkX usage (hence the original name).  The project was originally started\nto build a faster directed graph to use as the underlying data structure for\nthe DAG at the center of\n[qiskit](https://github.com/Qiskit/qiskit/)'s transpiler. However,\nsince its initial introduction the project has grown substantially and now\ncovers all applications that need to work with graphs which includes\nQiskit.\n","funding_links":[],"categories":["Rust","Python","Graph Manipulation","Software","Data Processing"],"sub_categories":["Others","Python"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FQiskit%2Frustworkx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FQiskit%2Frustworkx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FQiskit%2Frustworkx/lists"}