# peerappa14/v2i-based-traffic-congestion-prediction-and-route-optimization architecture

> Architecture diagram of the GitHub repository peerappa14/v2i-based-traffic-congestion-prediction-and-route-optimization, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/peerappa14/v2i-based-traffic-congestion-prediction-and-route-optimization
- Repository: https://github.com/peerappa14/v2i-based-traffic-congestion-prediction-and-route-optimization

## Overview

This repository is a SUMO-based V2I traffic monitoring and route-optimization prototype. Its main user workflow is to launch the GUI, run a SUMO simulation through TraCI, collect vehicle and edge state, detect congestion, reroute affected vehicles, and view network and rerouting statistics. Separate scripts generate RSU detector placements and demonstrate RSU-triggered vehicle speed changes. The README also describes LSTM forecasting and CSV storage, but the sampled GUI labels AI integration a placeholder; those capabilities are not represented as active runtime stages. Edges are limited to relationships shown in excerpts or README statements.

Main entry points: [`interface.py`](https://github.com/peerappa14/v2i-based-traffic-congestion-prediction-and-route-optimization/blob/main/interface.py) (GUI simulation control), [`generate_rsu.py`](https://github.com/peerappa14/v2i-based-traffic-congestion-prediction-and-route-optimization/blob/main/generate_rsu.py) (RSU placement generator), [`run_sumo.py`](https://github.com/peerappa14/v2i-based-traffic-congestion-prediction-and-route-optimization/blob/main/run_sumo.py) (RSU-aware simulation), [`osm.add.xml`](https://github.com/peerappa14/v2i-based-traffic-congestion-prediction-and-route-optimization/blob/main/osm.add.xml) (RSU detector configuration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_simulation["Traffic simulation"]
  node_launch_gui["GUI simulation control<br/>[interface.py]"]
  node_sumo_config["SUMO scenario configuration<br/>[osm.sumocfg]"]
  node_network_assets["Road network and routes<br/>[osm.net.xml]"]
end

subgraph group_monitoring["Monitoring and routing"]
  node_traffic_state["Traffic state collection<br/>[interface.py]"]
  node_congestion["Congestion detection<br/>[interface.py]"]
  node_rerouting["Dynamic rerouting<br/>[interface.py]"]
  node_route_script["Alternate route helper<br/>[reroute.py]"]
end

subgraph group_dashboard["Dashboard and visualization"]
  node_vehicle_tables["Vehicle and status tables<br/>[interface.py]"]
  node_network_view["Live network canvas<br/>[interface.py]"]
  node_trend_charts["Traffic trend charts<br/>[interface.py]"]
end

subgraph group_rsu["RSU tooling"]
  node_rsu_placement["RSU placement generator<br/>[generate_rsu.py]"]
  node_rsu_config["RSU detector configuration<br/>[osm.add.xml]"]
  node_rsu_sim["RSU-aware simulation<br/>[run_sumo.py]"]
  node_detector_log["Detector output"]
end

node_user(("Operator"))
node_sumo["SUMO simulator"]

node_user -->|"starts"| node_launch_gui
node_launch_gui -->|"starts simulation"| node_sumo
node_sumo -->|"supplies live state"| node_traffic_state
node_traffic_state -->|"provides edge data"| node_congestion
node_congestion -->|"triggers rerouting"| node_rerouting
node_traffic_state -->|"updates tables"| node_vehicle_tables
node_congestion -->|"updates status"| node_vehicle_tables
node_rerouting -->|"updates route table"| node_vehicle_tables
node_traffic_state -->|"drives display"| node_network_view
node_congestion -->|"plots counts"| node_trend_charts
node_rerouting -->|"plots reroutes"| node_trend_charts
node_launch_gui -->|"loads scenario"| node_sumo_config
node_launch_gui -->|"parses network"| node_network_assets
node_user -.->|"runs generator"| node_rsu_placement
node_rsu_placement -->|"queries junctions"| node_sumo
node_rsu_placement -->|"writes detectors"| node_rsu_config
node_rsu_placement -->|"configures output"| node_detector_log
node_rsu_sim -->|"reads positions"| node_rsu_config
node_rsu_sim -->|"runs simulation"| node_sumo
node_rsu_sim -.->|"may emit logs"| node_detector_log
node_route_script -->|"checks and changes routes"| node_sumo

click node_launch_gui "https://github.com/peerappa14/v2i-based-traffic-congestion-prediction-and-route-optimization/blob/main/interface.py"
click node_traffic_state "https://github.com/peerappa14/v2i-based-traffic-congestion-prediction-and-route-optimization/blob/main/interface.py"
click node_congestion "https://github.com/peerappa14/v2i-based-traffic-congestion-prediction-and-route-optimization/blob/main/interface.py"
click node_rerouting "https://github.com/peerappa14/v2i-based-traffic-congestion-prediction-and-route-optimization/blob/main/interface.py"
click node_vehicle_tables "https://github.com/peerappa14/v2i-based-traffic-congestion-prediction-and-route-optimization/blob/main/interface.py"
click node_network_view "https://github.com/peerappa14/v2i-based-traffic-congestion-prediction-and-route-optimization/blob/main/interface.py"
click node_trend_charts "https://github.com/peerappa14/v2i-based-traffic-congestion-prediction-and-route-optimization/blob/main/interface.py"
click node_route_script "https://github.com/peerappa14/v2i-based-traffic-congestion-prediction-and-route-optimization/blob/main/reroute.py"
click node_rsu_placement "https://github.com/peerappa14/v2i-based-traffic-congestion-prediction-and-route-optimization/blob/main/generate_rsu.py"
click node_rsu_config "https://github.com/peerappa14/v2i-based-traffic-congestion-prediction-and-route-optimization/blob/main/osm.add.xml"
click node_rsu_sim "https://github.com/peerappa14/v2i-based-traffic-congestion-prediction-and-route-optimization/blob/main/run_sumo.py"
click node_sumo_config "https://github.com/peerappa14/v2i-based-traffic-congestion-prediction-and-route-optimization/blob/main/osm.sumocfg"
click node_network_assets "https://github.com/peerappa14/v2i-based-traffic-congestion-prediction-and-route-optimization/blob/main/osm.net.xml"
click node_detector_log "https://github.com/peerappa14/v2i-based-traffic-congestion-prediction-and-route-optimization/blob/main/detector_output.xml"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_launch_gui,node_sumo_config,node_network_assets toneBlue
class node_traffic_state,node_congestion,node_rerouting,node_route_script toneAmber
class node_vehicle_tables,node_network_view,node_trend_charts toneMint
class node_rsu_placement,node_rsu_config,node_rsu_sim,node_detector_log toneRose
class node_user,node_sumo toneIndigo
```

## Components

### Traffic simulation

- [GUI simulation control](https://github.com/peerappa14/v2i-based-traffic-congestion-prediction-and-route-optimization/blob/main/interface.py): `interface.py`
- [SUMO scenario configuration](https://github.com/peerappa14/v2i-based-traffic-congestion-prediction-and-route-optimization/blob/main/osm.sumocfg): `osm.sumocfg`
- [Road network and routes](https://github.com/peerappa14/v2i-based-traffic-congestion-prediction-and-route-optimization/blob/main/osm.net.xml): `osm.net.xml`

### Monitoring and routing

- [Traffic state collection](https://github.com/peerappa14/v2i-based-traffic-congestion-prediction-and-route-optimization/blob/main/interface.py): `interface.py`
- [Congestion detection](https://github.com/peerappa14/v2i-based-traffic-congestion-prediction-and-route-optimization/blob/main/interface.py): `interface.py`
- [Dynamic rerouting](https://github.com/peerappa14/v2i-based-traffic-congestion-prediction-and-route-optimization/blob/main/interface.py): `interface.py`
- [Alternate route helper](https://github.com/peerappa14/v2i-based-traffic-congestion-prediction-and-route-optimization/blob/main/reroute.py): `reroute.py`

### Dashboard and visualization

- [Vehicle and status tables](https://github.com/peerappa14/v2i-based-traffic-congestion-prediction-and-route-optimization/blob/main/interface.py): `interface.py`
- [Live network canvas](https://github.com/peerappa14/v2i-based-traffic-congestion-prediction-and-route-optimization/blob/main/interface.py): `interface.py`
- [Traffic trend charts](https://github.com/peerappa14/v2i-based-traffic-congestion-prediction-and-route-optimization/blob/main/interface.py): `interface.py`

### RSU tooling

- [RSU placement generator](https://github.com/peerappa14/v2i-based-traffic-congestion-prediction-and-route-optimization/blob/main/generate_rsu.py): `generate_rsu.py`
- [RSU detector configuration](https://github.com/peerappa14/v2i-based-traffic-congestion-prediction-and-route-optimization/blob/main/osm.add.xml): `osm.add.xml`
- [RSU-aware simulation](https://github.com/peerappa14/v2i-based-traffic-congestion-prediction-and-route-optimization/blob/main/run_sumo.py): `run_sumo.py`
- [Detector output](https://github.com/peerappa14/v2i-based-traffic-congestion-prediction-and-route-optimization/blob/main/detector_output.xml): `detector_output.xml`

### Other components

- **Operator**
- **SUMO simulator**

## Connections

- Operator → GUI simulation control: starts (evidence: `README.md`)
- GUI simulation control → SUMO simulator: starts simulation (evidence: `interface.py`)
- SUMO simulator → Traffic state collection: supplies live state (evidence: `interface.py`)
- Traffic state collection → Congestion detection: provides edge data (evidence: `interface.py`)
- Congestion detection → Dynamic rerouting: triggers rerouting (evidence: `interface.py`)
- Traffic state collection → Vehicle and status tables: updates tables (evidence: `interface.py`)
- Congestion detection → Vehicle and status tables: updates status (evidence: `interface.py`)
- Dynamic rerouting → Vehicle and status tables: updates route table (evidence: `interface.py`)
- Traffic state collection → Live network canvas: drives display (evidence: `interface.py`)
- Congestion detection → Traffic trend charts: plots counts (evidence: `interface.py`)
- Dynamic rerouting → Traffic trend charts: plots reroutes (evidence: `interface.py`)
- GUI simulation control → SUMO scenario configuration: loads scenario (evidence: `interface.py`)
- GUI simulation control → Road network and routes: parses network (evidence: `interface.py`)
- Operator → RSU placement generator: runs generator
- RSU placement generator → SUMO simulator: queries junctions (evidence: `generate_rsu.py`)
- RSU placement generator → RSU detector configuration: writes detectors (evidence: `generate_rsu.py`)
- RSU placement generator → Detector output: configures output (evidence: `generate_rsu.py`)
- RSU-aware simulation → RSU detector configuration: reads positions (evidence: `run_sumo.py`)
- RSU-aware simulation → SUMO simulator: runs simulation (evidence: `run_sumo.py`)
- RSU-aware simulation → Detector output: may emit logs
- Alternate route helper → SUMO simulator: checks and changes routes (evidence: `reroute.py`)
