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.2.1.tar.gz
(75.5 kB
view hashes)
Built Distributions
graphlib2-0.2.1-cp37-abi3-win32.whl
(144.9 kB
view hashes)
Close
Hashes for graphlib2-0.2.1-cp37-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6bd9b31b0a6068b39351d5063d3d7380075f977fac0ae58df689262e27787236 |
|
MD5 | 24445dd0a230ce26861e04cfe04579e1 |
|
BLAKE2b-256 | 76bf8a3272cc5e6c71fdd1b866531959cf1df03645cf98cfef3836df8a948484 |
Close
Hashes for graphlib2-0.2.1-cp37-abi3-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 49ea1eeb065da3269a3f0f115a069934125a745205d2d967c999bb34081c84fb |
|
MD5 | e1ab882b85b34682df1566630ae3d5e2 |
|
BLAKE2b-256 | 7e6fe06d514111c32c956277dbd37ab5f8ac6419017055d181147517cb7d7d39 |
Close
Hashes for graphlib2-0.2.1-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 72b22c72584b3d1cda7a7401ae5ea87b69518640ade1e2ca4b4a6ee3d6aefd1f |
|
MD5 | 45e0e8614b4ac3b463cfe053353c3d34 |
|
BLAKE2b-256 | 1a88e4e3ec0afd9ed7f0ee55470a29dde83ebf277c57b394eb64810e70cfdf56 |
Close
Hashes for graphlib2-0.2.1-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a25c8b97e6930b2581a07e7c7662b222b1ca7f6fb3ebd77f2ad298c3b550dad4 |
|
MD5 | 3f2831496260c401e99966ae12cf5e50 |
|
BLAKE2b-256 | 83f79e82316fa4c6e65c1d53fd9d91a549e8fb88bf4333bc9d787d06348fe4c0 |
Close
Hashes for graphlib2-0.2.1-cp37-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 827fac292efeafbc8b98be5b52d5ec3814499426c378f3f30972fb022f3b348c |
|
MD5 | 4654036faf5f620b7307508ab931186b |
|
BLAKE2b-256 | 4a83618a1b23c004c15b45a81657bdbcd1dec737bfb3656350a93279f4b4fc41 |
Close
Hashes for graphlib2-0.2.1-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b88b1605323cd77964b219d07b2227cc4119c13ac1e485273329e68d9114a32e |
|
MD5 | 217d66ab0d379dac4fc5bedc56a143aa |
|
BLAKE2b-256 | c5f8304a6a1a86e7475d75196cfc6989d05a2fbbe9b132446662fa2886dd38df |
Close
Hashes for graphlib2-0.2.1-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f602b472e2ddb6a1730a28bdc9f172a1fc37307ec746c35683a8e3b408ef546 |
|
MD5 | 1c4b905538430a5297fc950607ed743d |
|
BLAKE2b-256 | ac03050beb3f8845bdfaa836a4b04981013ab7f079bbc50b8a2bdc772f86e649 |
Close
Hashes for graphlib2-0.2.1-cp37-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b492b4e0435e36b45263fab3c3d09411a82f4cb639d80f07224f20c210e453d |
|
MD5 | 56352ea3e7f41266eeec43cab1282473 |
|
BLAKE2b-256 | b666b7c12ca26c4ce7cbd023ad40223dd947ce2f2575dcea328800863b74b336 |
Close
Hashes for graphlib2-0.2.1-cp37-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b013e14057c989af723840c93a708e9cc4bb8da33ffd3ff940143e6031fc531d |
|
MD5 | 1acb19d239852ccadddbdf1bface36e4 |
|
BLAKE2b-256 | 75b9d8ae4d621315a4335bb94bb3a7419d5152f8d00e549ca4d1f085cbbfc7b7 |
Close
Hashes for graphlib2-0.2.1-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 27a2fe34c6eac7da5186fd4c525c71768ea54f0cb5710cb5effb9e0ff22811a2 |
|
MD5 | 37775e321db0d2f8dc9a85bfdae3bac3 |
|
BLAKE2b-256 | d3ce4d410b47b057e2513b7bd095809440d4cf5d706e6ef63831ca40f9281592 |
Close
Hashes for graphlib2-0.2.1-cp37-abi3-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 722a1a9e53b0df77de0b3e5f33d8055d4942928a1b125c9c81d965e09c5be416 |
|
MD5 | a27535639cd96a4c8f5bea8fc17e0298 |
|
BLAKE2b-256 | 7afd7484b642878520e409a6005e435320ef136d433dd13dfc602dcb06056802 |