Model Registry Contract
Every trained model directory must include both
info.json and weights.pt. Registry
functions rely on this contract for listing and loading.
The codebase is organized by responsibility: API routes, reusable model definitions, task-specific train/inference code, and static UI.
ai/
models/ # GCN, SAGE, GIN, Loopy implementations
registry.py # model discovery/load/save
degree/ # training + prediction for degree task
min_cycle/ # training + prediction for cycle task
cage/ # search + RL generator logic
trained/ # saved info.json + weights.pt artifacts
backend/
app.py # Flask app and static serving
routes/ # /api/degree, /api/min_cycle, /api/cage
utils/ # graph parsing and generation helpers
frontend/
index.html # landing
degree/ # degree UI
min_cycle/ # min-cycle UI
cage/ # cage generator UI
Every trained model directory must include both
info.json and weights.pt. Registry
functions rely on this contract for listing and loading.
Cage generation uses session IDs and background threads, with abandonment timeout and queue limit enforcement.
MAX_PARALLEL_GENERATIONS = 3
if active >= MAX_PARALLEL_GENERATIONS:
return jsonify({
"error": "Generating queue is full.",
"active_sessions": active,
"max_parallel_generations": MAX_PARALLEL_GENERATIONS
}), 429