Rust port of the Python stdlib graphlib modules
Project description
graphlib2
This is a Rust port of Python's stdlib graphlib. It passes all of the standard libraries tests and is a drop in replacement. This also happens to be Python 3.7 compatible, so it can be used as a backport. Since usage is exactly the same as the standard libraries, please refer to their documentation for usage details.
Example
from graphlib2 import TopologicalSorter
graph = {0: [1], 1: [2]} # 0 depends on 1, 1 depends on 2
ts = TopologicalSorter(graph)
ts.prepare()
while ts.is_active():
ready_nodes = ts.get_ready()
ts.done(*ready_nodes) # all at a time or one by one
Motivation
This was primarily written for di and for me to learn Rust. In other words: please vet the code yourself before using this.
Differences with the stdlib implementation
- Additional APIs for removing nodes from the graph (
TopologicalSorter.remove_nodes
) and copying a preparedTopologicalSorter
(TopologicalSorter.copy
). - A couple factors (~5x) faster for large highly branched graphs.
- Unlocks the GIL during certain operations, which can considerably speed up multithreaded workloads.
Development
- Clone the repo.
- Run
make init
- Run
make test
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
graphlib2-0.1.1.tar.gz
(74.7 kB
view hashes)
Built Distributions
graphlib2-0.1.1-cp37-abi3-win32.whl
(160.5 kB
view hashes)
Close
Hashes for graphlib2-0.1.1-cp37-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 09cee31c580500333843a8f428db7127290bd01cdd726d27da94eb7abbf0e049 |
|
MD5 | 182a8fcee4396d8a0de189c9f0a8b1e2 |
|
BLAKE2b-256 | 8d1f8a4481b0567605e51385f7b23aa1040ec8ec9474b82002248996969ea2dc |
Close
Hashes for graphlib2-0.1.1-cp37-abi3-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dbb5ebaf9dc945138bf58b3514fc145325e2e16ecbd4747f5c9d61beadb409f3 |
|
MD5 | 0ec24b8a8a9ef791d64d84fd082f77c0 |
|
BLAKE2b-256 | 13089e19aa5ff793e85ba9b0a102efb38f6b4c3c7126a336a2942c7f0498d3b5 |
Close
Hashes for graphlib2-0.1.1-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 066a513a4d8c133b8a3fb324ed37e68f96934572a61e432f99a2f0df83a1e240 |
|
MD5 | aa19fedbb379c599aa06e1abaa74d11a |
|
BLAKE2b-256 | cbb0a2e6d741bfaabc53029ec95bec1555c0d80246856a686e80af3238fedc50 |
Close
Hashes for graphlib2-0.1.1-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c46d12bea0f30c39f24f24279ce1c70c66a1a06a26abafb2fb02d775babba0e6 |
|
MD5 | ad6a0b0b29f83f93cdb391231e7e6e72 |
|
BLAKE2b-256 | e88baee034bdd383e7f97a7f33ad7139934687f0134d6a25f4ae0def81ce1449 |
Close
Hashes for graphlib2-0.1.1-cp37-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 50b891bc0d21cc8136600f3677225ff401e03a0173b12517e3bb0f60b650f948 |
|
MD5 | 6859df0a7b7b302dd4ea5fec141b29c1 |
|
BLAKE2b-256 | 9b81fd13795537301c910358f959ea50489e49f63d9f3a9b9586e752f0673b22 |
Close
Hashes for graphlib2-0.1.1-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cc71285a0a5077b6b3c9c823b50229e46cbeb64e6f42c0fd9f5e9a02ec4820ce |
|
MD5 | 6235a1a194d04d1fe36ada603f3638db |
|
BLAKE2b-256 | 5ddd44125996541bf304db3697ed5ba48320cf1718d29de8f92cf4d487accfdc |
Close
Hashes for graphlib2-0.1.1-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bfdd6955d9c297f33c4da8bbfe6cbcaaad966ef0ab0ca4eb836c11c0ac6963af |
|
MD5 | 574a5ee98fdc7231960439abda9480f1 |
|
BLAKE2b-256 | c4edad8f1f8148fc004649e70268be56de97f33e4458c3af28e73334ee84fbd0 |
Close
Hashes for graphlib2-0.1.1-cp37-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e97b7dd70c33ab3440bde22114c92b6fc1d77fde096b5b81bc98ae4053cec8de |
|
MD5 | 789b65febddd61de5b476a70f6f41657 |
|
BLAKE2b-256 | 8c47233a3a7a00940bae06a3954fa6cfbedd67d0f987e3b1782c86ee92a7d784 |
Close
Hashes for graphlib2-0.1.1-cp37-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4a4bbdc4b0b62adcff07fc334a146ed2f2674cbc21b6c5619aff134b30369496 |
|
MD5 | da64a4b886b9095886d340949ddda80c |
|
BLAKE2b-256 | 7c7f6dac69bc2de63c697c689d534a1fda05f7ed5302dbfe14f71acbb6d45556 |
Close
Hashes for graphlib2-0.1.1-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 235abb10496ab22f57c817df37a06cae306742bdb9c27aae1fcbc3149a4e4cc5 |
|
MD5 | 18dc48358aa7719322bfae9c4b86fe71 |
|
BLAKE2b-256 | fbcd999af2245ec51d5bcd24763cce39de5ae5eee20ff8d826cb0920b99ed55a |
Close
Hashes for graphlib2-0.1.1-cp37-abi3-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 15ff1b97e0f35fbb6ae3661823096880eeb19ce2ebf36f1ee5233bf1cc61a4e4 |
|
MD5 | 00aefe2774149b6bf9914f9811272db9 |
|
BLAKE2b-256 | 47edd7489b7d2387450726a81fad5a239eaae2fa3d0dc7756f465b6e5d9371ba |