# imashwith/ai-based_complexity_prediction_tool architecture

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

- Interactive diagram: https://gitdiagram.com/imashwith/ai-based_complexity_prediction_tool
- Repository: https://github.com/imashwith/ai-based_complexity_prediction_tool

## Overview

This is a browser-based complexity prediction tool. A user submits code and a language choice; the FastAPI endpoint passes them to a heuristic analyzer, which detects structure, derives features, classifies time and space complexity, and returns traceable results. The browser renders the verdict, feature table, step-by-step trace, and growth-curve comparison. The README documents the analyzer stages; the sampled source confirms the API handoff and client rendering. Internal analyzer stages are conceptual subdivisions of one file, not separately inspected modules.

Main entry points: [`frontend/script.js`](https://github.com/imashwith/ai-based_complexity_prediction_tool/blob/main/frontend/script.js) (Analyze request), [`backend/app.py`](https://github.com/imashwith/ai-based_complexity_prediction_tool/blob/main/backend/app.py) (Analysis API), [`frontend/index.html`](https://github.com/imashwith/ai-based_complexity_prediction_tool/blob/main/frontend/index.html) (Code input), [`backend/analyzer.py`](https://github.com/imashwith/ai-based_complexity_prediction_tool/blob/main/backend/analyzer.py) (Analysis engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Browser client"]
  node_input["Code input<br/>[index.html]"]
  node_client_request["Analyze request<br/>[script.js]"]
  node_result_view["Result and features<br/>[script.js]"]
  node_trace_view["Trace visualizer<br/>[script.js]"]
  node_growth_chart["Growth chart<br/>[script.js]"]
  node_page_style["Page presentation<br/>[style.css]"]
end

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

subgraph group_analysis["Analysis engine"]
  node_engine["Analysis engine<br/>[analyzer.py]"]
  node_normalize["Text normalization<br/>[analyzer.py]"]
  node_structure["Structure detection<br/>[analyzer.py]"]
  node_features["Feature extraction<br/>[analyzer.py]"]
  node_classify["Complexity classification<br/>[analyzer.py]"]
end

node_user(("Code submitter"))

node_user -->|"enters code"| node_input
node_input -->|"submits input"| node_client_request
node_client_request -->|"POSTs code"| node_api
node_api -->|"calls analyzer"| node_engine
node_engine -->|"starts analysis"| node_normalize
node_normalize -->|"feeds cleaned text"| node_structure
node_structure -->|"locates bodies"| node_features
node_features -->|"classifies features"| node_classify
node_classify -->|"returns analysis"| node_api
node_api -->|"returns JSON"| node_client_request
node_client_request -->|"renders results"| node_result_view
node_client_request -->|"renders trace"| node_trace_view
node_client_request -->|"plots complexity"| node_growth_chart
node_input -.->|"styled by"| node_page_style

click node_input "https://github.com/imashwith/ai-based_complexity_prediction_tool/blob/main/frontend/index.html"
click node_client_request "https://github.com/imashwith/ai-based_complexity_prediction_tool/blob/main/frontend/script.js"
click node_api "https://github.com/imashwith/ai-based_complexity_prediction_tool/blob/main/backend/app.py"
click node_engine "https://github.com/imashwith/ai-based_complexity_prediction_tool/blob/main/backend/analyzer.py"
click node_normalize "https://github.com/imashwith/ai-based_complexity_prediction_tool/blob/main/backend/analyzer.py"
click node_structure "https://github.com/imashwith/ai-based_complexity_prediction_tool/blob/main/backend/analyzer.py"
click node_features "https://github.com/imashwith/ai-based_complexity_prediction_tool/blob/main/backend/analyzer.py"
click node_classify "https://github.com/imashwith/ai-based_complexity_prediction_tool/blob/main/backend/analyzer.py"
click node_result_view "https://github.com/imashwith/ai-based_complexity_prediction_tool/blob/main/frontend/script.js"
click node_trace_view "https://github.com/imashwith/ai-based_complexity_prediction_tool/blob/main/frontend/script.js"
click node_growth_chart "https://github.com/imashwith/ai-based_complexity_prediction_tool/blob/main/frontend/script.js"
click node_page_style "https://github.com/imashwith/ai-based_complexity_prediction_tool/blob/main/frontend/style.css"

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_input,node_client_request,node_result_view,node_trace_view,node_growth_chart,node_page_style toneBlue
class node_api toneAmber
class node_engine,node_normalize,node_structure,node_features,node_classify toneMint
class node_user toneIndigo
```

## Components

### Browser client

- [Code input](https://github.com/imashwith/ai-based_complexity_prediction_tool/blob/main/frontend/index.html): `frontend/index.html`
- [Analyze request](https://github.com/imashwith/ai-based_complexity_prediction_tool/blob/main/frontend/script.js): `frontend/script.js`
- [Result and features](https://github.com/imashwith/ai-based_complexity_prediction_tool/blob/main/frontend/script.js): `frontend/script.js`
- [Trace visualizer](https://github.com/imashwith/ai-based_complexity_prediction_tool/blob/main/frontend/script.js): `frontend/script.js`
- [Growth chart](https://github.com/imashwith/ai-based_complexity_prediction_tool/blob/main/frontend/script.js): `frontend/script.js`
- [Page presentation](https://github.com/imashwith/ai-based_complexity_prediction_tool/blob/main/frontend/style.css): `frontend/style.css`

### Web service

- [Analysis API](https://github.com/imashwith/ai-based_complexity_prediction_tool/blob/main/backend/app.py): `backend/app.py`

### Analysis engine

- [Analysis engine](https://github.com/imashwith/ai-based_complexity_prediction_tool/blob/main/backend/analyzer.py): `backend/analyzer.py`
- [Text normalization](https://github.com/imashwith/ai-based_complexity_prediction_tool/blob/main/backend/analyzer.py): `backend/analyzer.py`
- [Structure detection](https://github.com/imashwith/ai-based_complexity_prediction_tool/blob/main/backend/analyzer.py): `backend/analyzer.py`
- [Feature extraction](https://github.com/imashwith/ai-based_complexity_prediction_tool/blob/main/backend/analyzer.py): `backend/analyzer.py`
- [Complexity classification](https://github.com/imashwith/ai-based_complexity_prediction_tool/blob/main/backend/analyzer.py): `backend/analyzer.py`

### Other components

- **Code submitter**

## Connections

- Code submitter → Code input: enters code (evidence: `README.md`)
- Code input → Analyze request: submits input (evidence: `frontend/script.js`)
- Analyze request → Analysis API: POSTs code (evidence: `frontend/script.js`)
- Analysis API → Analysis engine: calls analyzer (evidence: `backend/app.py`)
- Analysis engine → Text normalization: starts analysis (evidence: `README.md`)
- Text normalization → Structure detection: feeds cleaned text (evidence: `README.md`)
- Structure detection → Feature extraction: locates bodies (evidence: `README.md`)
- Feature extraction → Complexity classification: classifies features (evidence: `README.md`)
- Complexity classification → Analysis API: returns analysis (evidence: `backend/app.py`)
- Analysis API → Analyze request: returns JSON (evidence: `frontend/script.js`)
- Analyze request → Result and features: renders results (evidence: `frontend/script.js`)
- Analyze request → Trace visualizer: renders trace (evidence: `frontend/script.js`)
- Analyze request → Growth chart: plots complexity (evidence: `README.md`)
- Code input → Page presentation: styled by (evidence: `README.md`)
