File size: 2,663 Bytes
1af10cc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
"""
Concept graph data structure for TutorX knowledge base.
"""
from typing import Dict, Any

# Store the concept graph data in memory
CONCEPT_GRAPH = {
    "python": {
        "id": "python",
        "name": "Python Programming",
        "description": "Fundamentals of Python programming language",
        "prerequisites": [],
        "related": ["functions", "oop", "data_structures"]
    },
    "functions": {
        "id": "functions",
        "name": "Python Functions",
        "description": "Creating and using functions in Python",
        "prerequisites": ["python"],
        "related": ["decorators", "lambdas"]
    },
    "oop": {
        "id": "oop",
        "name": "Object-Oriented Programming",
        "description": "Classes and objects in Python",
        "prerequisites": ["python"],
        "related": ["inheritance", "polymorphism"]
    },
    "data_structures": {
        "id": "data_structures",
        "name": "Data Structures",
        "description": "Built-in data structures in Python",
        "prerequisites": ["python"],
        "related": ["algorithms"]
    },
    "decorators": {
        "id": "decorators",
        "name": "Python Decorators",
        "description": "Function decorators in Python",
        "prerequisites": ["functions"],
        "related": ["python", "functions"]
    },
    "lambdas": {
        "id": "lambdas",
        "name": "Lambda Functions",
        "description": "Anonymous functions in Python",
        "prerequisites": ["functions"],
        "related": ["python", "functions"]
    },
    "inheritance": {
        "id": "inheritance",
        "name": "Inheritance in OOP",
        "description": "Creating class hierarchies in Python",
        "prerequisites": ["oop"],
        "related": ["python", "oop"]
    },
    "polymorphism": {
        "id": "polymorphism",
        "name": "Polymorphism in OOP",
        "description": "Multiple forms of methods in Python",
        "prerequisites": ["oop"],
        "related": ["python", "oop"]
    },
    "algorithms": {
        "id": "algorithms",
        "name": "Basic Algorithms",
        "description": "Common algorithms in Python",
        "prerequisites": ["data_structures"],
        "related": ["python", "data_structures"]
    }
}

def get_concept(concept_id: str) -> Dict[str, Any]:
    """Get a specific concept by ID or return None if not found."""
    return CONCEPT_GRAPH.get(concept_id)

def get_all_concepts() -> Dict[str, Any]:
    """Get all concepts in the graph."""
    return {"concepts": list(CONCEPT_GRAPH.values())}

def get_concept_graph() -> Dict[str, Any]:
    """Get the complete concept graph."""
    return CONCEPT_GRAPH