study-buddy / app /services /graph_algorithm_evidence.py
GitHub Actions
deploy d092bea3608b7a29952f16357fda39b7a29e399b
2e818da
Raw
History Blame Contribute Delete
1.74 kB
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