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.