# chetalavenkatateja/smart-route-finder architecture

> Architecture diagram of the GitHub repository chetalavenkatateja/smart-route-finder, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/chetalavenkatateja/smart-route-finder
- Repository: https://github.com/chetalavenkatateja/smart-route-finder

## Overview

Smart Route Finder is a Flask web application for finding and comparing routes through a sample Hyderabad road network. A user selects endpoints and a routing algorithm; the backend loads a graph, computes an optimal route, finds alternatives, generates an explanation, and records query performance. The algorithm package includes Dijkstra, A*, and Floyd–Warshall, alongside shared graph and route-analysis components. The UI-to-API connection is shown as unverified because the frontend excerpt was not provided; the empty README offers no additional capability documentation.

Main entry points: [`smart route finder/backend/app.py`](https://github.com/chetalavenkatateja/smart-route-finder/blob/main/smart%20route%20finder/backend/app.py) (Flask API), [`smart route finder/algorithms/graph.py`](https://github.com/chetalavenkatateja/smart-route-finder/blob/main/smart%20route%20finder/algorithms/graph.py) (Road graph), [`smart route finder/backend/database.py`](https://github.com/chetalavenkatateja/smart-route-finder/blob/main/smart%20route%20finder/backend/database.py) (SQLite storage), [`smart route finder/algorithms/alternative_routes.py`](https://github.com/chetalavenkatateja/smart-route-finder/blob/main/smart%20route%20finder/algorithms/alternative_routes.py) (Alternative routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Web interface"]
  node_web_ui["Web UI<br/>[app.js]"]
end

subgraph group_service["Routing service"]
  node_api["Flask API<br/>[app.py]"]
end

subgraph group_algorithms["Routing algorithms"]
  node_graph["Road graph<br/>[graph.py]"]
  node_dijkstra["Dijkstra<br/>[dijkstra.py]"]
  node_astar["A* search<br/>[astar.py]"]
  node_floyd["Floyd–Warshall<br/>[floyd_warshall.py]"]
  node_alternatives["Alternative routes"]
  node_explainer["Route explainer<br/>[explainer.py]"]
end

subgraph group_data["Road network data"]
  node_database[("SQLite storage<br/>[database.py]")]
  node_sample_data["Sample road data<br/>[sample_data.py]"]
end

node_traveler(("Route seeker"))

node_traveler -.->|"chooses route"| node_web_ui
node_web_ui -.->|"submits request"| node_api
node_api -->|"loads graph"| node_database
node_database -->|"seeds records"| node_sample_data
node_database -->|"builds graph"| node_graph
node_api -->|"runs by default"| node_dijkstra
node_api -->|"dispatches request"| node_astar
node_api -->|"dispatches request"| node_floyd
node_dijkstra -->|"reads edges"| node_graph
node_astar -->|"reads edges"| node_graph
node_floyd -->|"reads edges"| node_graph
node_api -->|"finds detours"| node_alternatives
node_alternatives -->|"reruns search"| node_dijkstra
node_alternatives -->|"checks paths"| node_graph
node_api -->|"builds explanation"| node_explainer
node_api -->|"logs query"| node_database

click node_web_ui "https://github.com/chetalavenkatateja/smart-route-finder/blob/main/smart%20route%20finder/frontend/static/js/app.js"
click node_api "https://github.com/chetalavenkatateja/smart-route-finder/blob/main/smart%20route%20finder/backend/app.py"
click node_graph "https://github.com/chetalavenkatateja/smart-route-finder/blob/main/smart%20route%20finder/algorithms/graph.py"
click node_dijkstra "https://github.com/chetalavenkatateja/smart-route-finder/blob/main/smart%20route%20finder/algorithms/dijkstra.py"
click node_astar "https://github.com/chetalavenkatateja/smart-route-finder/blob/main/smart%20route%20finder/algorithms/astar.py"
click node_floyd "https://github.com/chetalavenkatateja/smart-route-finder/blob/main/smart%20route%20finder/algorithms/floyd_warshall.py"
click node_alternatives "https://github.com/chetalavenkatateja/smart-route-finder/blob/main/smart%20route%20finder/algorithms/alternative_routes.py"
click node_explainer "https://github.com/chetalavenkatateja/smart-route-finder/blob/main/smart%20route%20finder/algorithms/explainer.py"
click node_database "https://github.com/chetalavenkatateja/smart-route-finder/blob/main/smart%20route%20finder/backend/database.py"
click node_sample_data "https://github.com/chetalavenkatateja/smart-route-finder/blob/main/smart%20route%20finder/backend/sample_data.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_web_ui toneBlue
class node_api toneAmber
class node_graph,node_dijkstra,node_astar,node_floyd,node_alternatives,node_explainer,node_traveler toneMint
class node_database,node_sample_data toneRose
```

## Components

### Web interface

- [Web UI](https://github.com/chetalavenkatateja/smart-route-finder/blob/main/smart%20route%20finder/frontend/static/js/app.js): `smart route finder/frontend/static/js/app.js`

### Routing service

- [Flask API](https://github.com/chetalavenkatateja/smart-route-finder/blob/main/smart%20route%20finder/backend/app.py): `smart route finder/backend/app.py`

### Routing algorithms

- [Road graph](https://github.com/chetalavenkatateja/smart-route-finder/blob/main/smart%20route%20finder/algorithms/graph.py): `smart route finder/algorithms/graph.py`
- [Dijkstra](https://github.com/chetalavenkatateja/smart-route-finder/blob/main/smart%20route%20finder/algorithms/dijkstra.py): `smart route finder/algorithms/dijkstra.py`
- [A* search](https://github.com/chetalavenkatateja/smart-route-finder/blob/main/smart%20route%20finder/algorithms/astar.py): `smart route finder/algorithms/astar.py`
- [Floyd–Warshall](https://github.com/chetalavenkatateja/smart-route-finder/blob/main/smart%20route%20finder/algorithms/floyd_warshall.py): `smart route finder/algorithms/floyd_warshall.py`
- [Alternative routes](https://github.com/chetalavenkatateja/smart-route-finder/blob/main/smart%20route%20finder/algorithms/alternative_routes.py): `smart route finder/algorithms/alternative_routes.py`
- [Route explainer](https://github.com/chetalavenkatateja/smart-route-finder/blob/main/smart%20route%20finder/algorithms/explainer.py): `smart route finder/algorithms/explainer.py`

### Road network data

- [SQLite storage](https://github.com/chetalavenkatateja/smart-route-finder/blob/main/smart%20route%20finder/backend/database.py): `smart route finder/backend/database.py`
- [Sample road data](https://github.com/chetalavenkatateja/smart-route-finder/blob/main/smart%20route%20finder/backend/sample_data.py): `smart route finder/backend/sample_data.py`

### Other components

- **Route seeker**

## Connections

- Route seeker → Web UI: chooses route
- Web UI → Flask API: submits request
- Flask API → SQLite storage: loads graph (evidence: `smart route finder/backend/app.py`)
- SQLite storage → Sample road data: seeds records (evidence: `smart route finder/backend/database.py`)
- SQLite storage → Road graph: builds graph (evidence: `smart route finder/backend/database.py`)
- Flask API → Dijkstra: runs by default (evidence: `smart route finder/backend/app.py`)
- Flask API → A* search: dispatches request (evidence: `smart route finder/backend/app.py`)
- Flask API → Floyd–Warshall: dispatches request (evidence: `smart route finder/backend/app.py`)
- Dijkstra → Road graph: reads edges (evidence: `smart route finder/algorithms/dijkstra.py`)
- A* search → Road graph: reads edges (evidence: `smart route finder/algorithms/astar.py`)
- Floyd–Warshall → Road graph: reads edges (evidence: `smart route finder/algorithms/floyd_warshall.py`)
- Flask API → Alternative routes: finds detours (evidence: `smart route finder/backend/app.py`)
- Alternative routes → Dijkstra: reruns search (evidence: `smart route finder/algorithms/alternative_routes.py`)
- Alternative routes → Road graph: checks paths (evidence: `smart route finder/algorithms/alternative_routes.py`)
- Flask API → Route explainer: builds explanation (evidence: `smart route finder/backend/app.py`)
- Flask API → SQLite storage: logs query (evidence: `smart route finder/backend/app.py`)
