Implement of Depth First Search for a graph
Project description
Overview
PyGraph_DFS is a Python package that provides a straightforward and efficient way to perform Depth-First Search (DFS) on a graph. It is a versatile tool that can be used in various scenarios where graph traversal and exploration are necessary.
Installation
You can install PyGraph_DFS using pip:
pip install PyGraph_DFS
Usage
After installing the package, you can use it in your Python scripts as follows:
from PyGraph_DFS import GraphDFS
# Create a graph instance
my_graph = GraphDFS()
# Add edges to the graph
my_graph.add_edge("A", "B")
my_graph.add_edge("B", "C")
my_graph.add_edge("B", "D")
my_graph.add_edge("D", "E")
# Perform Depth-First Search (DFS)
visited_nodes = my_graph.dfs("A")
# Print the visited nodes
print(visited_nodes)
Example Output
The above code will produce the following output:
['A', 'B', 'C', 'D', 'E']
License
This project is licensed under the MIT License. See the LICENSE.
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
PyGraph_DFS-0.1.tar.gz
(2.5 kB
view hashes)
Built Distribution
Close
Hashes for PyGraph_DFS-0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7f5e99a085bf53d3ada52b6fafa7098f414246b45133faf418ac7d86539c8bb3 |
|
MD5 | 28db55677f9ecf700025186f07c87bde |
|
BLAKE2b-256 | 8db782e2c65bc61ebc78cafe6a12d2101a007d0beac69442aa2edc919738d8b5 |