Skip to content

logicarius/UrbanFlow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UrbanFlow — Traffic Network Simulation

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.


Problem

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.


Approach

Stage 1 — Structural Failure

Model a weak, tree-like network where all traffic is forced through a single node. Measure how topology alone causes guaranteed congestion.

Stage 2 — Structural Fix

Redesign the network with redundancy and multiple paths. Implement greedy capacity-based routing to distribute load. Measure improvement using LCI and CDR metrics.

Stage 3 — Dynamic Simulation

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.


Network Evolution

Stage 1 — Weak Topology (Forced Convergence)

All lanes feed into a single Connector node. One structural path exists.

Stage 1

Stage 2 — Resilient Topology (Redundancy Added)

Multiple paths introduced. Lanes connect directly to Main Road and Side Road.

Stage 2

Stage 3 — Dynamic Model (Same Resilient Network Over Time)

Same topology simulated across 10 time steps with constant inflow.

Stage 3


Key Metrics

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.


Key Insights

  1. Congestion can be structural, not volumetric — topology determines vulnerability
  2. Tree-like networks create guaranteed bottlenecks regardless of demand
  3. Redundancy reduces load concentration but does not eliminate hub dependency
  4. A network is dynamically stable only if average inflow ≤ effective exit capacity
  5. Structure controls vulnerability. Routing controls distribution. Time controls stability.

Project Structure

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

How to Run

pip install -r requirements.txt

python experiments/structural_failure.py
python experiments/flow_fix.py
python experiments/dynamic_simulation.py

Stack

  • Python
  • igraph — graph modeling and visualization
  • matplotlib — plotting

Context

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.

About

Simulation of urban traffic congestion as a function of network topology and flow dynamics.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages