from fastapi import APIRouter from loguru import logger from app.controllers.algorithms.graph_coloring import get_graph_coloring from app.models.domain.algorithms import GraphColoringRequest, GraphColoringResponse router = APIRouter() @router.post('/graph-coloring', response_model=GraphColoringResponse) async def get_graph_coloring_result(graph: GraphColoringRequest): is_solvable, colored = await get_graph_coloring(graph.graph) solution = { 'is_solvable': is_solvable, 'colored': colored } return solution