Dynamic traffic routing system that recalculates optimal paths based on real-time traffic conditions.
- Simulates traffic flow in a road network using directed graphs
- Recalculates shortest paths dynamically as traffic conditions change
- Models congestion with exponential time penalties based on car density
- Demonstrates limitations of static navigation systems
- Python 3
- Graph theory and shortest path algorithms (Dijkstra)
- Standard library: collections, heapq, copy
Clone the repository:
git clone https://github.com/acmpesuecc/traffic_simulation
cd traffic_simulationCreate and activate virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activateInstall dependencies:
pip install -r requirements.txtRun the simulation:
python traffic.pyWhen prompted:
- Enter start point (e.g., A)
- Enter end point (e.g., F)
- Observe dynamic route recalculation as traffic redistributes
traffic_simulation/
├── traffic.py # Main simulation script
├── requirements.txt # Python dependencies
├── README.md # Project documentation
├── CONTRIBUTING.md # Contribution guidelines
└── LICENSE # Open source license
Current implementation has several improvement opportunities:
- Bug in traffic propagation algorithm
- Missing Bellman-Ford alternative
- No graph visualization
- Inefficient data structures
- Limited library usage
See open issues for contribution opportunities.
See CONTRIBUTING.md for guidelines on:
- Setting up development environment
- Submitting bug reports
- Proposing enhancements
- Creating pull requests
This project is open source. See LICENSE file for details.