How buvan45/time-complexity-analyzer works
Complexity Lab is a web tool that estimates a code snippet’s Big-O category. The user edits code in the React workspace, submits it through the API client to FastAPI, and sees the prediction and caveats in the results panel. The backend combines TF-IDF text features with heuristic structural features, scales the latter, and invokes the trained classifier. README documents health/API documentation and containerized deployment; the sampled tree supports the health route, but contains no deployment configuration. Backend processing and result formatting share one source file.
Main entry points: main.py Prediction orchestration · api.js API client · App.jsx Editor and results · main.jsx React app mount
Components 12
Web workspace
- Editor and results
frontend/src/App.jsx - API client
frontend/src/api.js - React app mount
frontend/src/main.jsx
Analysis API
- Analysis API
backend/main.py - Prediction response
backend/main.py
Prediction pipeline
- Prediction orchestration
backend/main.py - TF-IDF features
backend/main.py - Structural features
backend/main.py - Feature scaler
backend/main.py - Complexity classifier
backend/main.py - Trained model bundle
backend/models/codecomplex_structural.pkl
Other components
- Code author
Connections 13
- Code author → Editor and results: enters code
README.md - React app mount → Editor and results: renders
frontend/src/main.jsx - Editor and results → API client: submits code
frontend/src/App.jsx - API client → Analysis API: POST analyze
frontend/src/api.js - Analysis API → Prediction orchestration: calls prediction
backend/main.py - Prediction orchestration → TF-IDF features: transforms text
backend/main.py - Prediction orchestration → Structural features: extracts features
backend/main.py - Prediction orchestration → Feature scaler: scales features
backend/main.py - Prediction orchestration → Complexity classifier: predicts class
backend/main.py - Analysis API → Prediction response: formats response
backend/main.py - Prediction response → API client: returns JSON
README.md - API client → Editor and results: returns result
frontend/src/App.jsx - Prediction orchestration → Trained model bundle: loads components
backend/main.py