A systems study of urban traffic congestion using graph modeling, routing algorithms, and dynamic simulation.
Built in 3 stages: structural failure → structural fix → dynamic stability analysis.
Why do cities get congested even when total traffic demand is moderate?
The answer is often not how much traffic exists, but where the network forces it to go.
This project investigates congestion as a structural and dynamic systems problem.
Model a weak, tree-like network where all traffic is forced through a single node. Measure how topology alone causes guaranteed congestion.
Redesign the network with redundancy and multiple paths. Implement greedy capacity-based routing to distribute load. Measure improvement using LCI and CDR metrics.
Simulate the fixed network over time with constant inflow. Observe queue accumulation, propagation, and stability behavior. Show that good topology does not guarantee stability under overload.
All lanes feed into a single Connector node. One structural path exists.
Multiple paths introduced. Lanes connect directly to Main Road and Side Road.
Same topology simulated across 10 time steps with constant inflow.
| Metric | Stage 1 | Stage 2 |
|---|---|---|
| Load Concentration Ratio (LCR) | 1.0 | — |
| Load Concentration Index (LCI) | — | 0.38 |
| Connector Dependency Ratio (CDR) | — | 1.0 |
| Total Simulation Delay (10 steps) | — | 825 |
LCR = 1.0 → 100% of traffic forced onto one path. Guaranteed congestion.
LCI = 0.38 → Below 0.4 threshold. Healthy load distribution after fix.
CDR = 1.0 → Connector remains a transit point even with redundancy. Structural dependency persists at the network level — a real insight about hub-based urban design.
Total Delay = 825 → Bridge accumulates +15 vehicles per step with no exit. Demonstrates dynamic instability when inflow exceeds exit capacity.
- Congestion can be structural, not volumetric — topology determines vulnerability
- Tree-like networks create guaranteed bottlenecks regardless of demand
- Redundancy reduces load concentration but does not eliminate hub dependency
- A network is dynamically stable only if average inflow ≤ effective exit capacity
- Structure controls vulnerability. Routing controls distribution. Time controls stability.
urbanflow/
├── network.py # Network definitions (weak + resilient topologies)
├── routing.py # Greedy capacity-based routing + metrics
├── simulation.py # Time-based queue simulation
├── visualize.py # Graph visualization using igraph
├── experiments/
│ ├── structural_failure.py # Stage 1: forced convergence
│ ├── flow_fix.py # Stage 2: redundancy + routing
│ └── dynamic_simulation.py # Stage 3: time-based stability
├── results/ # Network topology visualizations
└── requirements.txt
pip install -r requirements.txt
python experiments/structural_failure.py
python experiments/flow_fix.py
python experiments/dynamic_simulation.py- Python
- igraph — graph modeling and visualization
- matplotlib — plotting
This project is part of a self-study ML and systems engineering portfolio. It deliberately builds from scratch before using abstraction to develop genuine understanding of graph modeling, routing logic, and dynamic systems behavior.


