# vishwanatha01/flowgrid architecture

> Architecture diagram of the GitHub repository vishwanatha01/flowgrid, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vishwanatha01/flowgrid
- Repository: https://github.com/vishwanatha01/flowgrid

## Overview

FlowGrid is a synthetic-city traffic-management web application. Users explore live conditions, plan routes, optimize signals, run simulations, and inspect network analytics through a Flask API and browser UI. The principal workflow runs from a user request through Flask validation and domain services to graph/model results; those results are presented in the relevant UI. The graph preserves the README’s major product capabilities and core algorithm/service modules. Relationships are limited to README statements and indexed or excerpted references; unsampled UI wiring is not inferred.

Main entry points: [`app.py`](https://github.com/vishwanatha01/flowgrid/blob/main/app.py) (API and pages), [`simulation/routing.py`](https://github.com/vishwanatha01/flowgrid/blob/main/simulation/routing.py) (Route services), [`simulation/network.py`](https://github.com/vishwanatha01/flowgrid/blob/main/simulation/network.py) (Synthetic road network), [`analysis/network_analytics.py`](https://github.com/vishwanatha01/flowgrid/blob/main/analysis/network_analytics.py) (Network analytics)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_flask["API and pages<br/>[app.py]"]
  node_dashboard["Control center<br/>[dashboard.js]"]
  node_map["City map<br/>[map.js]"]
  node_routeui["Route planner<br/>[routes.js]"]
  node_signalui["Signal optimizer<br/>[signals.js]"]
  node_simui["Simulation lab<br/>[simulation.js]"]
  node_analyticsui["Analytics view<br/>[analytics.js]"]
end

subgraph group_city["Traffic model"]
  node_network[("Synthetic road network<br/>[network.py]")]
  node_live["Live traffic model<br/>[live.py]"]
end

subgraph group_routing["Route planning"]
  node_routingservice["Route services<br/>[routing.py]"]
  node_astar["A-star search<br/>[astar.py]"]
  node_dijkstra["Dijkstra search<br/>[dijkstra.py]"]
  node_bellman["Bellman-Ford search<br/>[bellman_ford.py]"]
  node_bfs["Breadth-first search<br/>[bfs.py]"]
  node_yen["Alternative routes<br/>[yen.py]"]
end

subgraph group_signals["Signals and simulation"]
  node_signalsvc["Signal timing algorithms<br/>[traffic_signal.py]"]
  node_engine["Queue simulation<br/>[engine.py]"]
end

subgraph group_insights["Analytics and forecasting"]
  node_benchmarks["Scaling benchmarks<br/>[benchmarks.py]"]
  node_analytics["Network analytics"]
  node_floyd["Floyd-Warshall<br/>[floyd_warshall.py]"]
  node_kruskal["Kruskal spanning tree<br/>[kruskal.py]"]
  node_forecastservice["Forecast service<br/>[forecasting.py]"]
  node_forecast["Holt-Winters model<br/>[forecast.py]"]
end

node_user(("Traffic operator"))

node_user -->|"requests"| node_flask
node_flask -->|"serves network"| node_network
node_flask -->|"routes requests"| node_routingservice
node_flask -->|"reads traffic"| node_live
node_flask -->|"runs simulations"| node_engine
node_flask -->|"computes timing"| node_signalsvc
node_flask -->|"requests benchmarks"| node_benchmarks
node_flask -->|"requests analytics"| node_analytics
node_flask -->|"requests forecasts"| node_forecastservice
node_flask -.->|"presents control center"| node_dashboard
node_flask -.->|"presents city map"| node_map
node_flask -.->|"presents route planner"| node_routeui
node_flask -.->|"presents signal optimizer"| node_signalui
node_flask -.->|"presents simulation lab"| node_simui
node_flask -.->|"presents analytics"| node_analyticsui
node_live -->|"uses roads"| node_network
node_routingservice -->|"gets conditions"| node_live
node_routingservice -->|"builds route graph"| node_network
node_routingservice -->|"dispatches search"| node_astar
node_routingservice -->|"dispatches search"| node_dijkstra
node_routingservice -->|"dispatches search"| node_bellman
node_routingservice -->|"dispatches search"| node_bfs
node_routingservice -->|"requests alternatives"| node_yen
node_yen -->|"finds spur paths"| node_dijkstra
node_engine -->|"uses signal timing"| node_signalsvc
node_analytics -->|"reads road graph"| node_network
node_analytics -->|"computes all pairs"| node_floyd
node_analytics -->|"computes spanning tree"| node_kruskal
node_forecastservice -->|"fits forecasts"| node_forecast
node_forecastservice -->|"uses demand profile"| node_live
node_forecastservice -->|"uses junction data"| node_network

click node_flask "https://github.com/vishwanatha01/flowgrid/blob/main/app.py"
click node_dashboard "https://github.com/vishwanatha01/flowgrid/blob/main/static/js/dashboard.js"
click node_map "https://github.com/vishwanatha01/flowgrid/blob/main/static/js/map.js"
click node_routeui "https://github.com/vishwanatha01/flowgrid/blob/main/static/js/routes.js"
click node_signalui "https://github.com/vishwanatha01/flowgrid/blob/main/static/js/signals.js"
click node_simui "https://github.com/vishwanatha01/flowgrid/blob/main/static/js/simulation.js"
click node_analyticsui "https://github.com/vishwanatha01/flowgrid/blob/main/static/js/analytics.js"
click node_network "https://github.com/vishwanatha01/flowgrid/blob/main/simulation/network.py"
click node_live "https://github.com/vishwanatha01/flowgrid/blob/main/simulation/live.py"
click node_routingservice "https://github.com/vishwanatha01/flowgrid/blob/main/simulation/routing.py"
click node_astar "https://github.com/vishwanatha01/flowgrid/blob/main/algorithms/astar.py"
click node_dijkstra "https://github.com/vishwanatha01/flowgrid/blob/main/algorithms/dijkstra.py"
click node_bellman "https://github.com/vishwanatha01/flowgrid/blob/main/algorithms/bellman_ford.py"
click node_bfs "https://github.com/vishwanatha01/flowgrid/blob/main/algorithms/bfs.py"
click node_yen "https://github.com/vishwanatha01/flowgrid/blob/main/algorithms/yen.py"
click node_signalsvc "https://github.com/vishwanatha01/flowgrid/blob/main/algorithms/traffic_signal.py"
click node_engine "https://github.com/vishwanatha01/flowgrid/blob/main/simulation/engine.py"
click node_benchmarks "https://github.com/vishwanatha01/flowgrid/blob/main/analysis/benchmarks.py"
click node_analytics "https://github.com/vishwanatha01/flowgrid/blob/main/analysis/network_analytics.py"
click node_floyd "https://github.com/vishwanatha01/flowgrid/blob/main/algorithms/floyd_warshall.py"
click node_kruskal "https://github.com/vishwanatha01/flowgrid/blob/main/algorithms/kruskal.py"
click node_forecastservice "https://github.com/vishwanatha01/flowgrid/blob/main/analysis/forecasting.py"
click node_forecast "https://github.com/vishwanatha01/flowgrid/blob/main/algorithms/forecast.py"

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_flask,node_dashboard,node_map,node_routeui,node_signalui,node_simui,node_analyticsui toneBlue
class node_network,node_live toneAmber
class node_routingservice,node_astar,node_dijkstra,node_bellman,node_bfs,node_yen toneMint
class node_signalsvc,node_engine toneRose
class node_benchmarks,node_analytics,node_floyd,node_kruskal,node_forecastservice,node_forecast,node_user toneIndigo
```

## Components

### Web application

- [API and pages](https://github.com/vishwanatha01/flowgrid/blob/main/app.py): `app.py`
- [Control center](https://github.com/vishwanatha01/flowgrid/blob/main/static/js/dashboard.js): `static/js/dashboard.js`
- [City map](https://github.com/vishwanatha01/flowgrid/blob/main/static/js/map.js): `static/js/map.js`
- [Route planner](https://github.com/vishwanatha01/flowgrid/blob/main/static/js/routes.js): `static/js/routes.js`
- [Signal optimizer](https://github.com/vishwanatha01/flowgrid/blob/main/static/js/signals.js): `static/js/signals.js`
- [Simulation lab](https://github.com/vishwanatha01/flowgrid/blob/main/static/js/simulation.js): `static/js/simulation.js`
- [Analytics view](https://github.com/vishwanatha01/flowgrid/blob/main/static/js/analytics.js): `static/js/analytics.js`

### Traffic model

- [Synthetic road network](https://github.com/vishwanatha01/flowgrid/blob/main/simulation/network.py): `simulation/network.py`
- [Live traffic model](https://github.com/vishwanatha01/flowgrid/blob/main/simulation/live.py): `simulation/live.py`

### Route planning

- [Route services](https://github.com/vishwanatha01/flowgrid/blob/main/simulation/routing.py): `simulation/routing.py`
- [A-star search](https://github.com/vishwanatha01/flowgrid/blob/main/algorithms/astar.py): `algorithms/astar.py`
- [Dijkstra search](https://github.com/vishwanatha01/flowgrid/blob/main/algorithms/dijkstra.py): `algorithms/dijkstra.py`
- [Bellman-Ford search](https://github.com/vishwanatha01/flowgrid/blob/main/algorithms/bellman_ford.py): `algorithms/bellman_ford.py`
- [Breadth-first search](https://github.com/vishwanatha01/flowgrid/blob/main/algorithms/bfs.py): `algorithms/bfs.py`
- [Alternative routes](https://github.com/vishwanatha01/flowgrid/blob/main/algorithms/yen.py): `algorithms/yen.py`

### Signals and simulation

- [Signal timing algorithms](https://github.com/vishwanatha01/flowgrid/blob/main/algorithms/traffic_signal.py): `algorithms/traffic_signal.py`
- [Queue simulation](https://github.com/vishwanatha01/flowgrid/blob/main/simulation/engine.py): `simulation/engine.py`

### Analytics and forecasting

- [Scaling benchmarks](https://github.com/vishwanatha01/flowgrid/blob/main/analysis/benchmarks.py): `analysis/benchmarks.py`
- [Network analytics](https://github.com/vishwanatha01/flowgrid/blob/main/analysis/network_analytics.py): `analysis/network_analytics.py`
- [Floyd-Warshall](https://github.com/vishwanatha01/flowgrid/blob/main/algorithms/floyd_warshall.py): `algorithms/floyd_warshall.py`
- [Kruskal spanning tree](https://github.com/vishwanatha01/flowgrid/blob/main/algorithms/kruskal.py): `algorithms/kruskal.py`
- [Forecast service](https://github.com/vishwanatha01/flowgrid/blob/main/analysis/forecasting.py): `analysis/forecasting.py`
- [Holt-Winters model](https://github.com/vishwanatha01/flowgrid/blob/main/algorithms/forecast.py): `algorithms/forecast.py`

### Other components

- **Traffic operator**

## Connections

- Traffic operator → API and pages: requests (evidence: `README.md`)
- API and pages → Synthetic road network: serves network (evidence: `app.py`)
- API and pages → Route services: routes requests (evidence: `app.py`)
- API and pages → Live traffic model: reads traffic (evidence: `app.py`)
- API and pages → Queue simulation: runs simulations (evidence: `app.py`)
- API and pages → Signal timing algorithms: computes timing (evidence: `app.py`)
- API and pages → Scaling benchmarks: requests benchmarks (evidence: `app.py`)
- API and pages → Network analytics: requests analytics (evidence: `app.py`)
- API and pages → Forecast service: requests forecasts (evidence: `app.py`)
- API and pages → Control center: presents control center (evidence: `README.md`)
- API and pages → City map: presents city map (evidence: `README.md`)
- API and pages → Route planner: presents route planner (evidence: `README.md`)
- API and pages → Signal optimizer: presents signal optimizer (evidence: `README.md`)
- API and pages → Simulation lab: presents simulation lab (evidence: `README.md`)
- API and pages → Analytics view: presents analytics (evidence: `README.md`)
- Live traffic model → Synthetic road network: uses roads (evidence: `simulation/live.py`)
- Route services → Live traffic model: gets conditions (evidence: `simulation/routing.py`)
- Route services → Synthetic road network: builds route graph (evidence: `simulation/routing.py`)
- Route services → A-star search: dispatches search (evidence: `simulation/routing.py`)
- Route services → Dijkstra search: dispatches search (evidence: `simulation/routing.py`)
- Route services → Bellman-Ford search: dispatches search (evidence: `simulation/routing.py`)
- Route services → Breadth-first search: dispatches search (evidence: `simulation/routing.py`)
- Route services → Alternative routes: requests alternatives (evidence: `simulation/routing.py`)
- Alternative routes → Dijkstra search: finds spur paths (evidence: `algorithms/yen.py`)
- Queue simulation → Signal timing algorithms: uses signal timing (evidence: `simulation/engine.py`)
- Network analytics → Synthetic road network: reads road graph (evidence: `analysis/network_analytics.py`)
- Network analytics → Floyd-Warshall: computes all pairs (evidence: `analysis/network_analytics.py`)
- Network analytics → Kruskal spanning tree: computes spanning tree (evidence: `analysis/network_analytics.py`)
- Forecast service → Holt-Winters model: fits forecasts (evidence: `analysis/forecasting.py`)
- Forecast service → Live traffic model: uses demand profile (evidence: `analysis/forecasting.py`)
- Forecast service → Synthetic road network: uses junction data (evidence: `analysis/forecasting.py`)
