Graphs and Depth First Search
Project description
Graph-DFS
This package allows for the creation of graphs. It also provides the depth first search algorithm.
Installation
pip install graph-dfs
How to use it?
To create a graph, do:
g = Graph(n)
where n
is the number of vertices. To create an arc from
vertex a
to vertex b
, do:
g.link(a, b)
where a
and b
are indices in the range [0, n - 1]
. You can perform a depth first search on the graph
with:
dfs = DFS(g)
dfs.start()
If you desire to obtain a topological sorting of the graph, then do so after a DFS with:
dfs.topological_sorting()
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
graph-dfs-0.0.8.tar.gz
(2.7 kB
view hashes)
Built Distribution
Close
Hashes for graph_dfs-0.0.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 142bc87f91d5f86edc040e642323bdbbc7ae6f7704bf048c330ff390e42d5eb2 |
|
MD5 | 6e0ea7ca9fdec60707bad1640d6eb026 |
|
BLAKE2b-256 | b1cf1ba0e778a3bb3b66b8a4a601baff5f4732e08bf870815743fdf1756583ff |