File size: 1,744 Bytes
2e818da
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from __future__ import annotations

from app.schemas.visual_lesson import EvidenceClaim, EvidenceSource


class GraphAlgorithmEvidenceResolver:
    async def resolve(self) -> tuple[list[EvidenceSource], list[EvidenceClaim]]:
        sources = [EvidenceSource(source_id="builtin:clrs-graph-search", origin="builtin", title="Introduction to Algorithms — Elementary Graph Algorithms and Single-Source Shortest Paths", excerpt="Canonical reference metadata for breadth-first search, depth-first search, Dijkstra's algorithm, and path reconstruction.", authority="canonical")]
        claims = [
            EvidenceClaim(claim_id="graph-bfs", text="Breadth-first search explores an unweighted graph by increasing edge distance and therefore finds a minimum-hop path.", claim_type="standard_definition", support_level="canonical", source_ids=["builtin:clrs-graph-search"]),
            EvidenceClaim(claim_id="graph-dfs", text="Depth-first search follows one branch before backtracking and does not generally guarantee a shortest path.", claim_type="standard_definition", support_level="canonical", source_ids=["builtin:clrs-graph-search"]),
            EvidenceClaim(claim_id="graph-dijkstra", text="Dijkstra's algorithm returns shortest weighted paths when every edge weight is non-negative.", claim_type="standard_definition", support_level="canonical", source_ids=["builtin:clrs-graph-search"]),
            EvidenceClaim(claim_id="graph-astar", text="A* returns an optimal path when its heuristic is admissible; this visualization derives a lower-bound Euclidean heuristic from the graph's edge weights.", claim_type="derived_fact", support_level="derived", source_ids=["builtin:clrs-graph-search"]),
        ]
        return sources, claims