Another fast graph algorithms library
Project description
Leafy Graph Library
Leafy is a python graph library written in cython. This mix gives the speed of writing the library in c with the benefit of python bindings.
Usage
Graph Objects
Leafy supports Sparse Graphs, these create Adjacencey lists underneath.
To instantiate a graph object we need to know the number of nodes (verticies) in the graph, and if the graph is directed. Graphs defualt to undirected.
from leafy import Graph
g = Graph(4, True)
g.add_edge(0, 1)
g.add_edge(2, 3)
g.add_edge(2, 1)
g.list
Search
Leafy can run Depth First Search (DFS) and Breadth First Search (BFS) on a graph and return the graph search properties.
To run a search we need to define the graph to search and the node to start from.
Before you can view the properties we must call .run()
.
from leafy.search import DFS
dfs = DFS(g, 0)
dfs.run()
dfs.simple_path(12)
dfs.bridges
Digraphs
For diagraphs leafy supports DFS which can be imported from leafy.digraph
from leafy.digraph import DFS
dfs = DFS(g, 0)
dfs.run()
dfs.is_dag
dfs.topological_order()
Shortest Distance
For network shortest path leafy supports single source Dijkstra which can be imported from leafy.shortest_path
from leafy.shortest_path import Dijkstra
dij = Dijkstra(g, 0)
dij.run()
dij.path(3)
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 Distributions
Built Distributions
File details
Details for the file leafy-1.0.0-cp311-cp311-win_amd64.whl
.
File metadata
- Download URL: leafy-1.0.0-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 164.1 kB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d1a67c8ecfdf06a0d72dfc8a35eb5451435dea9ba439989f1413b883a4c93d06 |
|
MD5 | 02767f20f2e8516c761358b5ea82bf61 |
|
BLAKE2b-256 | 96779009169b63cf6f18f9a9f21a02f0f76e90124f6afd08f0c99a15ce1a1661 |
File details
Details for the file leafy-1.0.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: leafy-1.0.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 1.0 MB
- Tags: CPython 3.11, manylinux: glibc 2.28+ x86-64, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a0b8ce228d00f8ce7f410a82ba620dbf721cf94e963de63b567f3fa9dbb3653b |
|
MD5 | d5c240bf70ba07f2aa516c1e7d62a7ee |
|
BLAKE2b-256 | b48dfa52381e1f5285189d73db9bd0e6a93a4be60616b1094ad351ed54b83412 |
File details
Details for the file leafy-1.0.0-cp311-cp311-macosx_10_9_universal2.whl
.
File metadata
- Download URL: leafy-1.0.0-cp311-cp311-macosx_10_9_universal2.whl
- Upload date:
- Size: 354.4 kB
- Tags: CPython 3.11, macOS 10.9+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 66c2a1b79b5b0d35372fb17d8f85e6170393fdf2b4311c7e40ecdb1777e9351b |
|
MD5 | 289567c78ff0ccd73188bd55c0cf4774 |
|
BLAKE2b-256 | 05249bcf80d6b83e9fbd6acce6c4345f6803476817a16092792713954512fecd |
File details
Details for the file leafy-1.0.0-cp310-cp310-win_amd64.whl
.
File metadata
- Download URL: leafy-1.0.0-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 163.4 kB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 34f3bd3b7b5933602cc73179cc055ec63e21ece0c4d01171ca4f518b8aa889d1 |
|
MD5 | f5cda89130601a981541cc568d227eb6 |
|
BLAKE2b-256 | e7cd44e0c7a658f9597ef5beca55655e3d146b69cfa6e4671a01e523a1288043 |
File details
Details for the file leafy-1.0.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: leafy-1.0.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 957.9 kB
- Tags: CPython 3.10, manylinux: glibc 2.28+ x86-64, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a791dc1abdb3e746c2222b0e2c6ade387b57b56c8ef8a17702d1da9e85b0314 |
|
MD5 | 368d87b9f44f3d00ca49a4ceb5172766 |
|
BLAKE2b-256 | 94778f684282db679f4554b9a12deb7a43e292ba8ffb9387ee4146af0201cf33 |
File details
Details for the file leafy-1.0.0-cp310-cp310-macosx_11_0_x86_64.whl
.
File metadata
- Download URL: leafy-1.0.0-cp310-cp310-macosx_11_0_x86_64.whl
- Upload date:
- Size: 176.0 kB
- Tags: CPython 3.10, macOS 11.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1967e1f019a3ed1d1d107ae31ce957d5cdf8d0264b078ed625643610efaf87e7 |
|
MD5 | 4b5cb66f208a3bf541ec7e4797f7cdcc |
|
BLAKE2b-256 | 8d88612efc203693452a04e5b0139551967e3f53f878e2f5b2fc807393f85bbd |
File details
Details for the file leafy-1.0.0-cp39-cp39-win_amd64.whl
.
File metadata
- Download URL: leafy-1.0.0-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 195.9 kB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 72facfd2b769c93ba6c04287961433411ed6bb4b9ba3e09bf476c73f84926f7b |
|
MD5 | f9515dfefba7aa57d6330627d43a4c12 |
|
BLAKE2b-256 | b7a859ad7be4a2e4a97c75f395720f0f9a0df6912fd574cfb8983ade8f09a31b |
File details
Details for the file leafy-1.0.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: leafy-1.0.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 973.7 kB
- Tags: CPython 3.9, manylinux: glibc 2.28+ x86-64, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d60f723a87b88ece7c9de85085fe571569afec77e54781ddbb6279ac6eb9af86 |
|
MD5 | b6c3db22fa619cf101b43d82a44c5150 |
|
BLAKE2b-256 | e00b3d47549e80beb4a899dabb1ed0c12d824d6ba6cb08cf7e7080eb44b015af |
File details
Details for the file leafy-1.0.0-cp39-cp39-macosx_11_0_x86_64.whl
.
File metadata
- Download URL: leafy-1.0.0-cp39-cp39-macosx_11_0_x86_64.whl
- Upload date:
- Size: 178.8 kB
- Tags: CPython 3.9, macOS 11.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 692c45d53616a069468c2d21ff199bad9d29d92b23d4a6e46fb2c24e4267d4e9 |
|
MD5 | 3f6ee32676390c3f5f6392eaf59b4d25 |
|
BLAKE2b-256 | 314446e5068efd4c2ad965028741d634f2fe058363beacd1ce299eecad2d1a83 |
File details
Details for the file leafy-1.0.0-cp38-cp38-win_amd64.whl
.
File metadata
- Download URL: leafy-1.0.0-cp38-cp38-win_amd64.whl
- Upload date:
- Size: 195.9 kB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d13debef0a074713efb7ab380dba69ecd0ab0a6e59db2573ad6a8f514064abf2 |
|
MD5 | ba1bdbc5c23c1c3b8b5ba7f20047b214 |
|
BLAKE2b-256 | 32416abc2ab2a2049f08e2a85d58c929cad7b3e0a8c7a7e394d33cd43eb7a350 |
File details
Details for the file leafy-1.0.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: leafy-1.0.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 965.6 kB
- Tags: CPython 3.8, manylinux: glibc 2.28+ x86-64, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d10803b3bb19aa4ae37620aefe04e039c759b2d405944a87edce11458728468 |
|
MD5 | 1b26d5ea97a7583715fd7b6b62453b58 |
|
BLAKE2b-256 | de06a3276c07819fffc849b6c0ffc3224d02d20cd1207259fcab5fde134ca121 |
File details
Details for the file leafy-1.0.0-cp38-cp38-macosx_11_0_x86_64.whl
.
File metadata
- Download URL: leafy-1.0.0-cp38-cp38-macosx_11_0_x86_64.whl
- Upload date:
- Size: 180.5 kB
- Tags: CPython 3.8, macOS 11.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | afd8776d8c24a3d3c2d6982d5d1a290137f63e06aa7d3abbb8a061a87b914d97 |
|
MD5 | c98d54f305e84031afefd30083830ff2 |
|
BLAKE2b-256 | a9f3c3b1a6c9ccd2c6f876d1bd5a1587352d6387a3f52a7d11bfa909fdcb6d58 |
File details
Details for the file leafy-1.0.0-cp37-cp37m-win_amd64.whl
.
File metadata
- Download URL: leafy-1.0.0-cp37-cp37m-win_amd64.whl
- Upload date:
- Size: 196.2 kB
- Tags: CPython 3.7m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 61d10c7f26b2d7b9a09c3719e2bc96da675a3c502aeb0e27903cccd0fe2d5d6d |
|
MD5 | 31c4cebf61780efe9e0b261d4278f5d6 |
|
BLAKE2b-256 | 5a096418af08eaa0fa170674981b9a697b7144a9674c6222a6ab9c0174c69587 |
File details
Details for the file leafy-1.0.0-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: leafy-1.0.0-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 893.4 kB
- Tags: CPython 3.7m, manylinux: glibc 2.28+ x86-64, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5763999916687da14f430d2fd4375f0135b1c812b1191f08528765d8551bedac |
|
MD5 | 929de67670cfe80c5064204ff846d18b |
|
BLAKE2b-256 | 7be455d82e97d44ad50f0b45a6d1713f4eb2ba3e225c10149f66d6a9e5f4c302 |
File details
Details for the file leafy-1.0.0-cp37-cp37m-macosx_11_0_x86_64.whl
.
File metadata
- Download URL: leafy-1.0.0-cp37-cp37m-macosx_11_0_x86_64.whl
- Upload date:
- Size: 180.1 kB
- Tags: CPython 3.7m, macOS 11.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e7c901e14355a2e9a7298c2a83c23cec2accd719b8e85be7b90080178b51d48 |
|
MD5 | 6256698b0a9165fad0314de383058367 |
|
BLAKE2b-256 | b185613fe44acea55f3cec5c53cfc4518901d2fe23d1afd0324fef12f901f69d |