The Python code implements a depth-first search (DFS) algorithm to find a path from the city of Arad to Bucharest in Romania. The DFS algorithm is implemented using a priority queue and a dictionary to keep track of nodes and their respective costs. The code begins by initializing a global variable global_node_id
to keep track of node IDs. The function get_next_node_id()
increments this global variable whenever a new node is encountered.
This project requires Python 3.12.1 or later. To set up the project:
-
Ensure Python 3.12.1 or a later version is installed on your system. You can download Python from python.org.
-
Clone or download the repository to your local machine.
git clone https://github.com/jaiswalchitransh/DFS-Searching-Algorithm.git
-
Open the project in your preferred Python environment (e.g., IDE or terminal).
-
Run the script (
dfs_searching_algo.py
) and observe the output.
Run the script:
python dfs_searching_algo.py
This executes the DFS algorithm to find a path from Arad to Bucharest in the Romania map graph.
- Implementation: Implements DFS using a priority queue for efficient pathfinding.
- Output: Outputs the path from Arad to Bucharest.
- Demonstration: Demonstrates dictionary usage for node management and cost calculation.
I, Chitransh Jaiswal developed this Project Individually. I was responsible for all aspects of the project, including design, development, testing, and documentation. Contributions to improve the efficiency, readability, or functionality of the code are welcome. To contribute:
- Fork the repository.
- Create a new branch (
git checkout -b feature/your-feature
). - Make your changes.
- Commit your changes (
git commit -am 'Add some feature'
). - Push to the branch (
git push origin feature/your-feature
). - Create a new Pull Request.
Please ensure your contributions adhere to the coding standards and follow the existing style and structure.
Thank you for your interest in the DFS Searching Algorithm!