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.5.tar.gz
(125.4 kB
view hashes)
Built Distributions
Close
Hashes for graphlib2-0.2.5-pp38-pypy38_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c2fe515e916bac0a5ae2c5e7553c6732609515fb64309072ea5ed6ad169308a0 |
|
MD5 | 540a47236641a6169ca1fd84cbfa8391 |
|
BLAKE2b-256 | 6d7699c706ea83908a7b39ed73cba03c1895decc41b9bc0c9b257c5ef69c04ff |
Close
Hashes for graphlib2-0.2.5-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d0f97ce43f10b17322f020e9f693377008354e62fbcdf00ea6c89c04ad4823a |
|
MD5 | 3738bd43d28219439c3f7b9caecd71e1 |
|
BLAKE2b-256 | 53120d4c810171fb4d7865f15c1f1633ad49d63fe20be64ff0f72360402ea1d0 |
Close
Hashes for graphlib2-0.2.5-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5eb4584f000431cb721b7da29a30c1d0500b8554b424494aeb363acab167a98f |
|
MD5 | 1a57fc2a5e95bc8cb3c8997b5e5fc3ed |
|
BLAKE2b-256 | 75e069fb07819b3d70c4e3d009df0acc6d64a432357615a0c07898b238ad63c8 |
Close
Hashes for graphlib2-0.2.5-pp38-pypy38_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 059f64b4c9c6cb9084cce4545d6cf57d098d0f07b85278b4584f60aeea0feda7 |
|
MD5 | 276afa46d7c67c03bb28745487c89798 |
|
BLAKE2b-256 | 5f33408495d95d853cb6d61f59632773fd975a7715a0daf1a4cc64c3e68f81f0 |
Close
Hashes for graphlib2-0.2.5-pp38-pypy38_pp73-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d11763f2a0562dd273f7a8ced9497532b3d47a5f162e33beae6fd31b5768ce5f |
|
MD5 | 1a77ab28ba0ec608a6b3061f5e744ea7 |
|
BLAKE2b-256 | b49e16e1cc1611550ebd2575e739050ac92eb6dfe0f83f3287d33082296838a8 |
Close
Hashes for graphlib2-0.2.5-pp37-pypy37_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f1bb35f494e8d24cc46e0d308cb645062210b3ea0ba988ef8ca4e8d7a90d9bc9 |
|
MD5 | 926a1969fe23e19481a9c6df1247391e |
|
BLAKE2b-256 | 805c6b8adb677087df947af301169582ae46dfc3d80d398d1449228cd6777722 |
Close
Hashes for graphlib2-0.2.5-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 91fc1330029ec07d0e56bca1dc5cd343ed12b2c1934966ad3009954175bbbef0 |
|
MD5 | 633eb507bf25d082fd428edfe0dc7264 |
|
BLAKE2b-256 | 4f8ede85dd560c9c13c7d7aff2d6886b7ea3eb1f9daa0cbdcda5425baedde885 |
Close
Hashes for graphlib2-0.2.5-pp37-pypy37_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1a1976382565e95e50ee17f7b2cc2cab4874fafc681631a3e8442df85aebe3aa |
|
MD5 | 1153d1d78af0cc1d7c5b86c2c0241d37 |
|
BLAKE2b-256 | 33b0579869dc87e5b299527f572fdbc80d9c3d6017111b9d32d15ddcb27340ee |
Close
Hashes for graphlib2-0.2.5-pp37-pypy37_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 87be899a24f330a4f8565d9f9ae07594b31a7b81fae304cb70c88d7c993df0e1 |
|
MD5 | be53db73dcc4865918ca7aff6b603c16 |
|
BLAKE2b-256 | 0fd94c33c24bf058379e445c93678f0a6ab96ae72c119bf7a527fd13a76e919e |
Close
Hashes for graphlib2-0.2.5-pp37-pypy37_pp73-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e488fbf28408d08f18ce3e18d671e3d409489a42558a731f9172eb3e00d5718 |
|
MD5 | 3df7e39e9a354fa5fe92383fb9962f96 |
|
BLAKE2b-256 | e1133863c5098338fc9bc34d1d14b1dec3ea982df4d967017bf52427091baa80 |
Close
Hashes for graphlib2-0.2.5-cp37-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 188facb1dcc1ca61eb197972de07e073f6c64556a42633952d39c62d7506b55a |
|
MD5 | a623504fa12b758245460496b1dd6bfe |
|
BLAKE2b-256 | 1c29384257276d3dbeb1a25661097362d330fc5d03a370ead11009e5f9aa60c3 |
Close
Hashes for graphlib2-0.2.5-cp37-abi3-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a32b38f5776ee2abbd91a87367775aeb49cad3f2774bc71b5667515086a5521 |
|
MD5 | 54ee0f23d35126c536bc4a730fb9fde5 |
|
BLAKE2b-256 | d466087739922d6b3641cfc148e2da6d07afa13b46326283580b1be968443750 |
Close
Hashes for graphlib2-0.2.5-cp37-abi3-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d26e986f78fb3ac88064e23813f1cd12864405eadf6cbbeeb191f9c527e134a9 |
|
MD5 | 852e204c379cef74907895cc22598e66 |
|
BLAKE2b-256 | 2be5fdd558d97ab1cf5fd64812fc378709b7770696152090ac06279de9a6b92d |
Close
Hashes for graphlib2-0.2.5-cp37-abi3-musllinux_1_1_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 796db3540dc20e5b0328a1a980bd3f594f10f849fe8573295b2909b57fb66576 |
|
MD5 | da3e947c0a3f37de85c415253917cf1d |
|
BLAKE2b-256 | 2554c1f94080f76e0df95ba3ab20f0e69a7f62d62c81c8db127f3107385c9d35 |
Close
Hashes for graphlib2-0.2.5-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d152159f1fbb40e7afe57364f497d2af625a536ba334631fbf33eee4db2045b2 |
|
MD5 | 417916c0bd97922e04763900be26f073 |
|
BLAKE2b-256 | 7462a6733f01062217f15349647cecaafbf087b2bd64a4e5d8a4adf852bbd9fe |
Close
Hashes for graphlib2-0.2.5-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 776f7904d5531a3cabaeed3c27223882c06ca3a238e8d8d966b0e805ae766375 |
|
MD5 | 174dd7e5f0b5681990378ee0cb0a61d0 |
|
BLAKE2b-256 | 3cf4180997dedaa182e8fb0a00f3406ab78122705b0804369c7cd0ffb5d034b6 |
Close
Hashes for graphlib2-0.2.5-cp37-abi3-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | adb488f39dc83037563479238b9924ef28422785c96cbeb1a50af756733c8914 |
|
MD5 | 2b53fc0487efac0fb40fc2b733fe27d9 |
|
BLAKE2b-256 | 1d5b5f6e28bc74066e4c4385e467bbc851c6524ba1d1c78592df000b0a0ea5d8 |
Close
Hashes for graphlib2-0.2.5-cp37-abi3-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 414cf55b9949d9a026c0fb43757486e8667d21bfaadc9844b55f385878f377e2 |
|
MD5 | e95dc4ee081791c125e32b28e8ce3dcc |
|
BLAKE2b-256 | f0d6b70a3563c8820968a9443d85a70de2d0c0b156329cda799f8128fdbaac99 |