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.opological_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.6.tar.gz
(2.7 kB
view hashes)
Built Distribution
Close
Hashes for graph_dfs-0.0.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 36f444e65c9377f95729957865c3a84971e6e6a9be7da75ed2e954b006154887 |
|
MD5 | 45784734133fe19548767b76db57d6de |
|
BLAKE2b-256 | df308ea4a8605146b23d103cff9c8f6ae7fb6d16f03f438cb0cf2baa474699ef |