This mini-project demonstrates how graph algorithms (BFS & DFS) can be applied to real-world problems like emergency vehicle routing in urban cities. It helps simulate how ambulances, fire trucks, or police vehicles can find the shortest path in a road network using Breadth-First Search (BFS) and compare it with Depth-First Search (DFS).
- Visualize the city road network as a graph (nodes = locations, edges = roads).
- Input start and goal locations through GUI.
- BFS Path → Finds & animates the shortest path.
- DFS Path → Finds & animates a possible path (not always shortest).
- Best Path → Compares BFS vs DFS paths.
- Ambulance animation showing the route step-by-step.
-
Language: Python 3.x
-
Libraries:
Tkinter→ GUI developmentNetworkX→ Graph creation & visualizationMatplotlib→ Graph plotting & animationCollections (deque)→ Efficient BFS queue
-
IDE: VS Code / PyCharm / Jupyter Notebook
-
OS: Windows / Linux / Mac
📦 Emergency-Vehicle-Routing
┣ 📜 main.py # Project source code
┣ 📜 README.md # Project documentation
┗ 📂 screenshots # Output screenshots
-
Graph Representation
- Nodes → Locations (Hospital, School, Mall, Fire Station, etc.)
- Edges → Roads between locations
-
Algorithms
- BFS → Finds shortest path in unweighted graphs
- DFS → Explores a path (not always shortest)
-
GUI Components
- Start & Goal input fields
- Buttons: BFS Path | DFS Path | Best Path | Clear
- Ambulance route animation
-
Clone the repository
git clone https://github.com/your-username/emergency-routing-system.git cd emergency-routing-system -
Install dependencies
pip install matplotlib networkx
-
Run the project
python main.py
- NetworkX Documentation
- Matplotlib Documentation
- Tkinter Documentation
- Cormen, T. H., Leiserson, C. E., Rivest, R. L., & Stein, C. Introduction to Algorithms, MIT Press.
This project shows the practical application of graph algorithms in real-life emergency routing. It highlights why BFS is preferred over DFS for shortest-path problems in unweighted graphs, while also providing an interactive and educational GUI simulation.