from core.mind.knowledge_graph import AlgorithmNode, PrincipleNode, ProblemNode


def get_seed_algorithms() -> list[AlgorithmNode]:
    return [
        # ── SORTING (10) ──
        AlgorithmNode(name="quick_sort", code="def quick_sort(arr): ...",
            time_complexity="O(n log n)", space_complexity="O(log n)",
            principles=["divide_conquer"], best_for=["sorting", "general_purpose"],
            discovered_by="built_in", performance_history=[0.95],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),
        AlgorithmNode(name="merge_sort", code="def merge_sort(arr): ...",
            time_complexity="O(n log n)", space_complexity="O(n)",
            principles=["divide_conquer"], best_for=["sorting", "stable_sort", "linked_list"],
            discovered_by="built_in", performance_history=[0.93],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),
        AlgorithmNode(name="heap_sort", code="def heap_sort(arr): ...",
            time_complexity="O(n log n)", space_complexity="O(1)",
            principles=["divide_conquer"], best_for=["sorting", "in_place"],
            discovered_by="built_in", performance_history=[0.90],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),
        AlgorithmNode(name="tim_sort", code="def tim_sort(arr): ...",
            time_complexity="O(n log n)", space_complexity="O(n)",
            principles=["optimal_substructure", "divide_conquer"],
            best_for=["sorting", "nearly_sorted", "real_world"],
            discovered_by="built_in", performance_history=[0.97],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=["merge_sort", "insertion_sort"]),
        AlgorithmNode(name="insertion_sort", code="def insertion_sort(arr): ...",
            time_complexity="O(n\u00b2)", space_complexity="O(1)",
            principles=["greedy_exchange"], best_for=["sorting", "small_n", "nearly_sorted"],
            discovered_by="built_in", performance_history=[0.85],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),
        AlgorithmNode(name="bubble_sort", code="def bubble_sort(arr): ...",
            time_complexity="O(n\u00b2)", space_complexity="O(1)",
            principles=["greedy_exchange"], best_for=["sorting", "educational", "small_n"],
            discovered_by="built_in", performance_history=[0.70],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),
        AlgorithmNode(name="selection_sort", code="def selection_sort(arr): ...",
            time_complexity="O(n\u00b2)", space_complexity="O(1)",
            principles=["greedy_exchange"], best_for=["sorting", "small_n", "minimal_writes"],
            discovered_by="built_in", performance_history=[0.72],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),
        AlgorithmNode(name="radix_sort", code="def radix_sort(arr): ...",
            time_complexity="O(nk)", space_complexity="O(n+k)",
            principles=["divide_conquer"], best_for=["sorting", "integers", "fixed_width"],
            discovered_by="built_in", performance_history=[0.88],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),
        AlgorithmNode(name="counting_sort", code="def counting_sort(arr): ...",
            time_complexity="O(n+k)", space_complexity="O(n+k)",
            principles=["hashing_fingerprint"], best_for=["sorting", "integers", "small_range"],
            discovered_by="built_in", performance_history=[0.90],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),
        AlgorithmNode(name="shell_sort", code="def shell_sort(arr): ...",
            time_complexity="O(n^1.5)", space_complexity="O(1)",
            principles=["divide_conquer"], best_for=["sorting", "in_place", "medium_n"],
            discovered_by="built_in", performance_history=[0.82],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=["insertion_sort"]),

        # ── PATHFINDING (6) ──
        AlgorithmNode(name="dijkstra", code="def dijkstra(graph, src): ...",
            time_complexity="O((V+E) log V)", space_complexity="O(V+E)",
            principles=["greedy_exchange"], best_for=["pathfinding", "weighted", "single_source"],
            discovered_by="built_in", performance_history=[0.95],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),
        AlgorithmNode(name="bfs", code="def bfs(graph, src): ...",
            time_complexity="O(V+E)", space_complexity="O(V)",
            principles=["graph_connectivity"], best_for=["pathfinding", "unweighted", "shortest_path"],
            discovered_by="built_in", performance_history=[0.97],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),
        AlgorithmNode(name="a_star", code="def a_star(graph, src, goal, heuristic): ...",
            time_complexity="O(E log V)", space_complexity="O(V)",
            principles=["greedy_exchange", "information_theoretic"],
            best_for=["pathfinding", "weighted", "single_target", "heuristic"],
            discovered_by="built_in", performance_history=[0.93],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=["dijkstra"]),
        AlgorithmNode(name="bellman_ford", code="def bellman_ford(graph, src): ...",
            time_complexity="O(VE)", space_complexity="O(V)",
            principles=["optimal_substructure"],
            best_for=["pathfinding", "negative_weights", "single_source"],
            discovered_by="built_in", performance_history=[0.85],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),
        AlgorithmNode(name="floyd_warshall", code="def floyd_warshall(graph): ...",
            time_complexity="O(V\u00b3)", space_complexity="O(V\u00b2)",
            principles=["optimal_substructure"],
            best_for=["pathfinding", "all_pairs", "negative_weights"],
            discovered_by="built_in", performance_history=[0.80],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),
        AlgorithmNode(name="dfs", code="def dfs(graph, src): ...",
            time_complexity="O(V+E)", space_complexity="O(V)",
            principles=["graph_connectivity"],
            best_for=["pathfinding", "traversal", "cycle_detection", "topological"],
            discovered_by="built_in", performance_history=[0.92],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),

        # ── SEARCHING (4) ──
        AlgorithmNode(name="binary_search", code="def binary_search(arr, target): ...",
            time_complexity="O(log n)", space_complexity="O(1)",
            principles=["monotonic_feasibility", "divide_conquer"],
            best_for=["searching", "sorted_array"],
            discovered_by="built_in", performance_history=[0.98],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),
        AlgorithmNode(name="linear_search", code="def linear_search(arr, target): ...",
            time_complexity="O(n)", space_complexity="O(1)",
            principles=[], best_for=["searching", "unsorted", "small_n"],
            discovered_by="built_in", performance_history=[0.80],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),
        AlgorithmNode(name="interpolation_search", code="def interpolation_search(arr, target): ...",
            time_complexity="O(log log n)", space_complexity="O(1)",
            principles=["monotonic_feasibility"],
            best_for=["searching", "sorted", "uniform_distribution"],
            discovered_by="built_in", performance_history=[0.85],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=["binary_search"]),
        AlgorithmNode(name="exponential_search", code="def exponential_search(arr, target): ...",
            time_complexity="O(log n)", space_complexity="O(1)",
            principles=["monotonic_feasibility", "divide_conquer"],
            best_for=["searching", "sorted", "unbounded"],
            discovered_by="built_in", performance_history=[0.90],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=["binary_search"]),

        # ── OPTIMIZATION (5) ──
        AlgorithmNode(name="gradient_descent", code="def gradient_descent(f, grad_f, x0, lr, epochs): ...",
            time_complexity="O(epochs \u00d7 n)", space_complexity="O(n)",
            principles=["greedy_exchange"], best_for=["optimization", "continuous", "differentiable"],
            discovered_by="built_in", performance_history=[0.88],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),
        AlgorithmNode(name="simulated_annealing", code="def simulated_annealing(f, x0, schedule): ...",
            time_complexity="O(iterations \u00d7 eval)", space_complexity="O(n)",
            principles=["monotonic_feasibility"], best_for=["optimization", "discrete", "non_convex"],
            discovered_by="built_in", performance_history=[0.82],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),
        AlgorithmNode(name="genetic_algorithm", code="def genetic_algorithm(fitness, pop_size, generations): ...",
            time_complexity="O(generations \u00d7 pop_size \u00d7 eval)", space_complexity="O(pop_size \u00d7 n)",
            principles=["greedy_exchange"], best_for=["optimization", "combinatorial", "multi_modal"],
            discovered_by="built_in", performance_history=[0.78],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),
        AlgorithmNode(name="particle_swarm", code="def particle_swarm(f, n_particles, iterations): ...",
            time_complexity="O(iterations \u00d7 n_particles \u00d7 eval)", space_complexity="O(n_particles \u00d7 n)",
            principles=["greedy_exchange"], best_for=["optimization", "continuous", "multi_objective"],
            discovered_by="built_in", performance_history=[0.80],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),
        AlgorithmNode(name="hill_climbing", code="def hill_climbing(f, neighbors, x0): ...",
            time_complexity="O(iterations \u00d7 neighbor_cost)", space_complexity="O(n)",
            principles=["greedy_exchange"], best_for=["optimization", "discrete", "simple_landscape"],
            discovered_by="built_in", performance_history=[0.75],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),

        # ── ML_CLASSIFICATION (5) ──
        AlgorithmNode(name="knn_classifier", code="def knn_classifier(X_train, y_train, X_test, k): ...",
            time_complexity="O(n_train \u00d7 n_test \u00d7 d)", space_complexity="O(n_train \u00d7 d)",
            principles=["optimal_substructure"], best_for=["ml_classification", "small_data", "non_linear"],
            discovered_by="built_in", performance_history=[0.82],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),
        AlgorithmNode(name="decision_tree_classifier", code="def decision_tree_classifier(X, y, max_depth): ...",
            time_complexity="O(n \u00d7 d \u00d7 depth)", space_complexity="O(nodes)",
            principles=["greedy_exchange", "information_theoretic"],
            best_for=["ml_classification", "interpretable", "mixed_types"],
            discovered_by="built_in", performance_history=[0.85],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),
        AlgorithmNode(name="random_forest_classifier", code="def random_forest_classifier(X, y, n_trees): ...",
            time_complexity="O(n_trees \u00d7 n \u00d7 d \u00d7 depth)", space_complexity="O(n_trees \u00d7 nodes)",
            principles=["divide_conquer", "information_theoretic"],
            best_for=["ml_classification", "robust", "high_dim"],
            discovered_by="built_in", performance_history=[0.92],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=["decision_tree_classifier"]),
        AlgorithmNode(name="svm_classifier", code="def svm_classifier(X, y, kernel, C): ...",
            time_complexity="O(n\u00b2 \u00d7 d) to O(n\u00b3)", space_complexity="O(n\u00b2)",
            principles=["optimal_substructure"], best_for=["ml_classification", "binary", "high_dim", "kernel"],
            discovered_by="built_in", performance_history=[0.88],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),
        AlgorithmNode(name="naive_bayes", code="def naive_bayes(X, y): ...",
            time_complexity="O(n \u00d7 d)", space_complexity="O(d \u00d7 classes)",
            principles=["optimal_substructure"], best_for=["ml_classification", "text", "fast", "high_dim"],
            discovered_by="built_in", performance_history=[0.83],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),

        # ── ML_REGRESSION (5) ──
        AlgorithmNode(name="linear_regression", code="def linear_regression(X, y): ...",
            time_complexity="O(n \u00d7 d\u00b2)", space_complexity="O(d\u00b2)",
            principles=["optimal_substructure"], best_for=["ml_regression", "linear", "fast"],
            discovered_by="built_in", performance_history=[0.90],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),
        AlgorithmNode(name="polynomial_regression", code="def polynomial_regression(X, y, degree): ...",
            time_complexity="O(n \u00d7 d^degree)", space_complexity="O(d^degree)",
            principles=["optimal_substructure"], best_for=["ml_regression", "non_linear", "curve_fitting"],
            discovered_by="built_in", performance_history=[0.82],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=["linear_regression"]),
        AlgorithmNode(name="ridge_regression", code="def ridge_regression(X, y, alpha): ...",
            time_complexity="O(n \u00d7 d\u00b2)", space_complexity="O(d\u00b2)",
            principles=["optimal_substructure"], best_for=["ml_regression", "regularized", "multicollinear"],
            discovered_by="built_in", performance_history=[0.88],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=["linear_regression"]),
        AlgorithmNode(name="lasso_regression", code="def lasso_regression(X, y, alpha): ...",
            time_complexity="O(n \u00d7 d \u00d7 iterations)", space_complexity="O(d)",
            principles=["greedy_exchange", "optimal_substructure"],
            best_for=["ml_regression", "sparse", "feature_selection"],
            discovered_by="built_in", performance_history=[0.86],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=["linear_regression"]),
        AlgorithmNode(name="knn_regressor", code="def knn_regressor(X_train, y_train, X_test, k): ...",
            time_complexity="O(n_train \u00d7 n_test \u00d7 d)", space_complexity="O(n_train \u00d7 d)",
            principles=["optimal_substructure"], best_for=["ml_regression", "non_linear", "small_data"],
            discovered_by="built_in", performance_history=[0.80],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=["knn_classifier"]),

        # ── CLUSTERING (5) ──
        AlgorithmNode(name="kmeans", code="def kmeans(X, k, max_iter): ...",
            time_complexity="O(n \u00d7 k \u00d7 d \u00d7 iter)", space_complexity="O(k \u00d7 d)",
            principles=["greedy_exchange", "optimal_substructure"],
            best_for=["clustering", "spherical", "large_data"],
            discovered_by="built_in", performance_history=[0.85],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),
        AlgorithmNode(name="dbscan", code="def dbscan(X, eps, min_samples): ...",
            time_complexity="O(n\u00b2)", space_complexity="O(n)",
            principles=["graph_connectivity"],
            best_for=["clustering", "arbitrary_shape", "outlier_detection"],
            discovered_by="built_in", performance_history=[0.83],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),
        AlgorithmNode(name="hierarchical_clustering", code="def hierarchical_clustering(X, linkage): ...",
            time_complexity="O(n\u00b2 log n) to O(n\u00b3)", space_complexity="O(n\u00b2)",
            principles=["greedy_exchange", "optimal_substructure"],
            best_for=["clustering", "hierarchy", "small_data", "dendrogram"],
            discovered_by="built_in", performance_history=[0.80],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),
        AlgorithmNode(name="gaussian_mixture", code="def gaussian_mixture(X, k, max_iter): ...",
            time_complexity="O(n \u00d7 k \u00d7 d\u00b2 \u00d7 iter)", space_complexity="O(k \u00d7 d\u00b2)",
            principles=["optimal_substructure"], best_for=["clustering", "soft_assignment", "ellipsoidal"],
            discovered_by="built_in", performance_history=[0.82],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=["kmeans"]),
        AlgorithmNode(name="spectral_clustering", code="def spectral_clustering(X, k): ...",
            time_complexity="O(n\u00b3)", space_complexity="O(n\u00b2)",
            principles=["graph_flow_cut", "optimal_substructure"],
            best_for=["clustering", "non_convex", "graph_based"],
            discovered_by="built_in", performance_history=[0.78],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),

        # ── NLP (5) ──
        AlgorithmNode(name="tokenizer", code="def tokenizer(text): ...",
            time_complexity="O(n)", space_complexity="O(n)",
            principles=["hashing_fingerprint"], best_for=["nlp", "tokenization", "preprocessing"],
            discovered_by="built_in", performance_history=[0.95],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),
        AlgorithmNode(name="sentiment_analyzer", code="def sentiment_analyzer(text): ...",
            time_complexity="O(n)", space_complexity="O(vocab)",
            principles=["hashing_fingerprint", "optimal_substructure"],
            best_for=["nlp", "sentiment", "classification"],
            discovered_by="built_in", performance_history=[0.82],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),
        AlgorithmNode(name="ner_extractor", code="def ner_extractor(text): ...",
            time_complexity="O(n)", space_complexity="O(n)",
            principles=["optimal_substructure"], best_for=["nlp", "named_entity", "sequence_labeling"],
            discovered_by="built_in", performance_history=[0.80],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),
        AlgorithmNode(name="text_classifier", code="def text_classifier(texts, labels): ...",
            time_complexity="O(n \u00d7 d)", space_complexity="O(d \u00d7 classes)",
            principles=["optimal_substructure", "hashing_fingerprint"],
            best_for=["nlp", "classification", "bag_of_words"],
            discovered_by="built_in", performance_history=[0.84],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=["naive_bayes"]),
        AlgorithmNode(name="bag_of_words", code="def bag_of_words(texts): ...",
            time_complexity="O(n \u00d7 l)", space_complexity="O(vocab)",
            principles=["hashing_fingerprint"], best_for=["nlp", "feature_extraction", "sparse"],
            discovered_by="built_in", performance_history=[0.88],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),

        # ── GRAPH (5) ──
        AlgorithmNode(name="topological_sort", code="def topological_sort(graph): ...",
            time_complexity="O(V+E)", space_complexity="O(V+E)",
            principles=["graph_connectivity"], best_for=["graph", "dag", "ordering", "dependencies"],
            discovered_by="built_in", performance_history=[0.95],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),
        AlgorithmNode(name="connected_components", code="def connected_components(graph): ...",
            time_complexity="O(V+E)", space_complexity="O(V)",
            principles=["graph_connectivity"], best_for=["graph", "connectivity", "undirected"],
            discovered_by="built_in", performance_history=[0.97],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),
        AlgorithmNode(name="euler_path", code="def euler_path(graph): ...",
            time_complexity="O(V+E)", space_complexity="O(V)",
            principles=["graph_connectivity", "greedy_exchange"],
            best_for=["graph", "euler", "traversal"],
            discovered_by="built_in", performance_history=[0.88],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),
        AlgorithmNode(name="graph_coloring", code="def graph_coloring(graph, k): ...",
            time_complexity="O(k^V)", space_complexity="O(V)",
            principles=["optimal_substructure", "greedy_exchange"],
            best_for=["graph", "coloring", "scheduling", "np_hard"],
            discovered_by="built_in", performance_history=[0.70],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),
        AlgorithmNode(name="minimum_spanning_tree", code="def minimum_spanning_tree(graph): ...",
            time_complexity="O(E log V)", space_complexity="O(V+E)",
            principles=["greedy_exchange", "graph_connectivity"],
            best_for=["graph", "mst", "kruskal", "prim"],
            discovered_by="built_in", performance_history=[0.95],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),

        # ── STRING (5) ──
        AlgorithmNode(name="pattern_match", code="def pattern_match(text, pattern): ...",
            time_complexity="O(n \u00d7 m)", space_complexity="O(1)",
            principles=["hashing_fingerprint"], best_for=["string", "pattern", "matching"],
            discovered_by="built_in", performance_history=[0.85],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),
        AlgorithmNode(name="levenshtein", code="def levenshtein(s1, s2): ...",
            time_complexity="O(n \u00d7 m)", space_complexity="O(min(n,m))",
            principles=["optimal_substructure"], best_for=["string", "edit_distance", "similarity"],
            discovered_by="built_in", performance_history=[0.92],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),
        AlgorithmNode(name="rabin_karp", code="def rabin_karp(text, pattern): ...",
            time_complexity="O(n+m)", space_complexity="O(1)",
            principles=["hashing_fingerprint"], best_for=["string", "pattern", "rolling_hash"],
            discovered_by="built_in", performance_history=[0.90],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),
        AlgorithmNode(name="boyer_moore", code="def boyer_moore(text, pattern): ...",
            time_complexity="O(n/m) best, O(n\u00d7m) worst", space_complexity="O(m + alphabet)",
            principles=["information_theoretic"], best_for=["string", "pattern", "sublinear"],
            discovered_by="built_in", performance_history=[0.88],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),
        AlgorithmNode(name="suffix_array", code="def suffix_array(text): ...",
            time_complexity="O(n log n)", space_complexity="O(n)",
            principles=["divide_conquer", "hashing_fingerprint"],
            best_for=["string", "suffix", "repeated_substring"],
            discovered_by="built_in", performance_history=[0.85],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),

        # ── DYNAMIC_PROGRAMMING (5) ──
        AlgorithmNode(name="knapsack", code="def knapsack(weights, values, capacity): ...",
            time_complexity="O(n \u00d7 capacity)", space_complexity="O(capacity)",
            principles=["optimal_substructure"],
            best_for=["dp", "optimization", "discrete", "resource_allocation"],
            discovered_by="built_in", performance_history=[0.92],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),
        AlgorithmNode(name="lcs", code="def lcs(s1, s2): ...",
            time_complexity="O(n \u00d7 m)", space_complexity="O(min(n,m))",
            principles=["optimal_substructure"], best_for=["dp", "sequence", "common_subsequence"],
            discovered_by="built_in", performance_history=[0.93],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),
        AlgorithmNode(name="lis", code="def lis(arr): ...",
            time_complexity="O(n log n)", space_complexity="O(n)",
            principles=["optimal_substructure", "monotonic_feasibility"],
            best_for=["dp", "sequence", "increasing", "patience_sorting"],
            discovered_by="built_in", performance_history=[0.90],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),
        AlgorithmNode(name="matrix_chain", code="def matrix_chain(dims): ...",
            time_complexity="O(n\u00b3)", space_complexity="O(n\u00b2)",
            principles=["optimal_substructure"],
            best_for=["dp", "optimization", "matrix", "parenthesization"],
            discovered_by="built_in", performance_history=[0.85],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),
        AlgorithmNode(name="coin_change", code="def coin_change(coins, amount): ...",
            time_complexity="O(n \u00d7 amount)", space_complexity="O(amount)",
            principles=["optimal_substructure"],
            best_for=["dp", "counting", "min_coins", "unbounded"],
            discovered_by="built_in", performance_history=[0.92],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),

        # ── TREE (5) ──
        AlgorithmNode(name="bst_operations", code="def bst_insert(root, val): ...",
            time_complexity="O(h)", space_complexity="O(h)",
            principles=["divide_conquer"], best_for=["tree", "binary_search", "ordered"],
            discovered_by="built_in", performance_history=[0.90],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),
        AlgorithmNode(name="avl_tree", code="def avl_insert(root, val): ...",
            time_complexity="O(log n)", space_complexity="O(n)",
            principles=["divide_conquer", "amortized_invariant"],
            best_for=["tree", "balanced", "ordered", "guaranteed_log"],
            discovered_by="built_in", performance_history=[0.88],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=["bst_operations"]),
        AlgorithmNode(name="segment_tree", code="def segment_tree_build(arr): ...",
            time_complexity="O(log n) per query", space_complexity="O(n)",
            principles=["optimal_substructure", "divide_conquer"],
            best_for=["tree", "range_query", "point_update"],
            discovered_by="built_in", performance_history=[0.87],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),
        AlgorithmNode(name="fenwick_tree", code="def fenwick_tree_build(arr): ...",
            time_complexity="O(log n) per query", space_complexity="O(n)",
            principles=["optimal_substructure", "amortized_invariant"],
            best_for=["tree", "range_query", "prefix_sum", "compact"],
            discovered_by="built_in", performance_history=[0.88],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=["segment_tree"]),
        AlgorithmNode(name="trie", code="def trie_insert(root, word): ...",
            time_complexity="O(L) per operation", space_complexity="O(total_chars)",
            principles=["divide_conquer", "hashing_fingerprint"],
            best_for=["tree", "prefix", "autocomplete", "dictionary"],
            discovered_by="built_in", performance_history=[0.90],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),

        # ── MATH (5) ──
        AlgorithmNode(name="gcd", code="def gcd(a, b): ...",
            time_complexity="O(log min(a,b))", space_complexity="O(1)",
            principles=["divide_conquer"], best_for=["math", "number_theory", "gcd", "euclidean"],
            discovered_by="built_in", performance_history=[0.98],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),
        AlgorithmNode(name="prime_sieve", code="def prime_sieve(n): ...",
            time_complexity="O(n log log n)", space_complexity="O(n)",
            principles=["amortized_invariant"], best_for=["math", "primes", "sieve", "eratosthenes"],
            discovered_by="built_in", performance_history=[0.95],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),
        AlgorithmNode(name="modular_arithmetic", code="def mod_pow(base, exp, mod): ...",
            time_complexity="O(log exp)", space_complexity="O(1)",
            principles=["divide_conquer"],
            best_for=["math", "modular", "exponentiation", "cryptography"],
            discovered_by="built_in", performance_history=[0.97],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),
        AlgorithmNode(name="matrix_ops", code="def matrix_multiply(A, B): ...",
            time_complexity="O(n\u00b3)", space_complexity="O(n\u00b2)",
            principles=["divide_conquer"], best_for=["math", "matrix", "linear_algebra"],
            discovered_by="built_in", performance_history=[0.85],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),
        AlgorithmNode(name="fft", code="def fft(x): ...",
            time_complexity="O(n log n)", space_complexity="O(n)",
            principles=["divide_conquer"],
            best_for=["math", "polynomial", "convolution", "signal"],
            discovered_by="built_in", performance_history=[0.90],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),

        # ── IMAGE (5) ──
        AlgorithmNode(name="edge_detection", code="def edge_detection(image, method): ...",
            time_complexity="O(w \u00d7 h \u00d7 k\u00b2)", space_complexity="O(w \u00d7 h)",
            principles=["divide_conquer"], best_for=["image", "edge", "sobel", "canny"],
            discovered_by="built_in", performance_history=[0.85],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),
        AlgorithmNode(name="threshold", code="def threshold(image, method): ...",
            time_complexity="O(w \u00d7 h)", space_complexity="O(w \u00d7 h)",
            principles=["monotonic_feasibility"], best_for=["image", "threshold", "binary", "otsu"],
            discovered_by="built_in", performance_history=[0.88],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),
        AlgorithmNode(name="morphology", code="def morphology(image, operation, kernel): ...",
            time_complexity="O(w \u00d7 h \u00d7 k\u00b2)", space_complexity="O(w \u00d7 h)",
            principles=["amortized_invariant"], best_for=["image", "morphology", "erosion", "dilation"],
            discovered_by="built_in", performance_history=[0.83],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),
        AlgorithmNode(name="convolution", code="def convolution(image, kernel): ...",
            time_complexity="O(w \u00d7 h \u00d7 k\u00b2)", space_complexity="O(w \u00d7 h)",
            principles=["divide_conquer"], best_for=["image", "filter", "blur", "sharpen"],
            discovered_by="built_in", performance_history=[0.86],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),
        AlgorithmNode(name="histogram", code="def histogram(image): ...",
            time_complexity="O(w \u00d7 h)", space_complexity="O(256)",
            principles=["hashing_fingerprint"], best_for=["image", "histogram", "equalization", "stats"],
            discovered_by="built_in", performance_history=[0.92],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),

        # ── BACKTRACKING (5) ──
        AlgorithmNode(name="n_queens", code="def n_queens(n): ...",
            time_complexity="O(n!)", space_complexity="O(n)",
            principles=["optimal_substructure"], best_for=["backtracking", "constraint", "chess", "placement"],
            discovered_by="built_in", performance_history=[0.80],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),
        AlgorithmNode(name="sudoku", code="def sudoku(board): ...",
            time_complexity="O(9^(n\u00b2))", space_complexity="O(n\u00b2)",
            principles=["optimal_substructure", "amortized_invariant"],
            best_for=["backtracking", "constraint", "puzzle"],
            discovered_by="built_in", performance_history=[0.82],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),
        AlgorithmNode(name="subset_sum", code="def subset_sum(arr, target): ...",
            time_complexity="O(2^n)", space_complexity="O(n)",
            principles=["optimal_substructure"], best_for=["backtracking", "subset", "sum", "decision"],
            discovered_by="built_in", performance_history=[0.78],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),
        AlgorithmNode(name="permutation", code="def permutation(arr): ...",
            time_complexity="O(n!)", space_complexity="O(n)",
            principles=["optimal_substructure"], best_for=["backtracking", "permutation", "arrangement"],
            discovered_by="built_in", performance_history=[0.90],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),
        AlgorithmNode(name="combination", code="def combination(arr, k): ...",
            time_complexity="O(C(n,k))", space_complexity="O(k)",
            principles=["optimal_substructure"], best_for=["backtracking", "combination", "selection"],
            discovered_by="built_in", performance_history=[0.92],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=["permutation"]),

        # ── GREEDY (5) ──
        AlgorithmNode(name="huffman", code="def huffman(freq): ...",
            time_complexity="O(n log n)", space_complexity="O(n)",
            principles=["greedy_exchange"], best_for=["greedy", "compression", "encoding", "optimal_prefix"],
            discovered_by="built_in", performance_history=[0.95],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),
        AlgorithmNode(name="activity_selection", code="def activity_selection(activities): ...",
            time_complexity="O(n log n)", space_complexity="O(1)",
            principles=["greedy_exchange"],
            best_for=["greedy", "interval", "scheduling", "maximum_activities"],
            discovered_by="built_in", performance_history=[0.93],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=[]),
        AlgorithmNode(name="job_scheduling", code="def job_scheduling(jobs): ...",
            time_complexity="O(n log n)", space_complexity="O(n)",
            principles=["greedy_exchange", "optimal_substructure"],
            best_for=["greedy", "scheduling", "deadline", "profit"],
            discovered_by="built_in", performance_history=[0.85],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=["activity_selection"]),
        AlgorithmNode(name="fractional_knapsack", code="def fractional_knapsack(items, capacity): ...",
            time_complexity="O(n log n)", space_complexity="O(1)",
            principles=["greedy_exchange"], best_for=["greedy", "knapsack", "fractional", "continuous"],
            discovered_by="built_in", performance_history=[0.92],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=["knapsack"]),
        AlgorithmNode(name="kruskal_mst", code="def kruskal_mst(graph): ...",
            time_complexity="O(E log E)", space_complexity="O(V+E)",
            principles=["greedy_exchange", "graph_connectivity"],
            best_for=["greedy", "mst", "kruskal", "union_find"],
            discovered_by="built_in", performance_history=[0.94],
            correctness_verified=True, times_used=0, times_succeeded=0,
            created_at="0", parent_algorithms=["minimum_spanning_tree"]),
    ]


def get_seed_principles() -> list[PrincipleNode]:
    return [
        PrincipleNode(name="optimal_substructure",
            mathematical_basis="Bellman's Principle of Optimality",
            applicable_to=["optimization", "counting", "decision", "sequence"],
            complexity_guarantee="Exponential \u2192 Polynomial via memoization",
            success_rate=0.0),
        PrincipleNode(name="greedy_exchange",
            mathematical_basis="Exchange Argument + Matroid Theory",
            applicable_to=["scheduling", "selection", "covering", "encoding"],
            complexity_guarantee="O(n log n) sort + O(n) greedy scan",
            success_rate=0.0),
        PrincipleNode(name="monotonic_feasibility",
            mathematical_basis="Binary Search on Monotone Predicate",
            applicable_to=["optimization", "search", "decision", "threshold"],
            complexity_guarantee="O(log M \u00d7 check_cost)",
            success_rate=0.0),
        PrincipleNode(name="amortized_invariant",
            mathematical_basis="Potential Method + Invariant Maintenance",
            applicable_to=["sequence", "range_query", "streaming", "stack"],
            complexity_guarantee="O(n) amortized total",
            success_rate=0.0),
        PrincipleNode(name="divide_conquer",
            mathematical_basis="Master Theorem: T(n) = aT(n/b) + f(n)",
            applicable_to=["sorting", "search", "tree", "geometry", "matrix"],
            complexity_guarantee="Per Master Theorem",
            success_rate=0.0),
        PrincipleNode(name="hashing_fingerprint",
            mathematical_basis="Birthday Paradox + Polynomial Hashing",
            applicable_to=["string", "set", "lookup", "dedup", "frequency"],
            complexity_guarantee="O(1) amortized per operation",
            success_rate=0.0),
        PrincipleNode(name="graph_flow_cut",
            mathematical_basis="Max-Flow Min-Cut Theorem (Ford-Fulkerson)",
            applicable_to=["network", "matching", "connectivity", "bipartite"],
            complexity_guarantee="O(V\u00b2E) Dinic's",
            success_rate=0.0),
        PrincipleNode(name="information_theoretic",
            mathematical_basis="Information Theory Lower Bounds",
            applicable_to=["sorting", "search", "comparison", "decision_tree"],
            complexity_guarantee="Proves theoretical lower bounds",
            success_rate=0.0),
    ]


def get_seed_problems() -> list[ProblemNode]:
    return [
        ProblemNode(signature="SORTING", description="Sort elements in specified order",
            domain="integers", hidden_structure="total_order",
            constraints={"n": 10**5}, best_algorithm="tim_sort",
            solved_count=0, difficulty=0.2, solution_history=[]),
        ProblemNode(signature="PATHFINDING", description="Find path between nodes in graph",
            domain="graph", hidden_structure="graph_connectivity",
            constraints={"n": 10**4}, best_algorithm="dijkstra",
            solved_count=0, difficulty=0.4, solution_history=[]),
        ProblemNode(signature="SEARCHING", description="Find element in collection",
            domain="array", hidden_structure="ordered_or_unordered",
            constraints={"n": 10**5}, best_algorithm="binary_search",
            solved_count=0, difficulty=0.2, solution_history=[]),
        ProblemNode(signature="OPTIMIZATION", description="Find optimal solution in solution space",
            domain="numbers", hidden_structure="optimal_substructure",
            constraints={"n": 10**3}, best_algorithm="gradient_descent",
            solved_count=0, difficulty=0.6, solution_history=[]),
        ProblemNode(signature="ML_CLASSIFICATION", description="Classify data points into categories",
            domain="feature_matrix", hidden_structure="statistical_separation",
            constraints={"n": 10**4, "d": 100}, best_algorithm="random_forest_classifier",
            solved_count=0, difficulty=0.5, solution_history=[]),
        ProblemNode(signature="ML_REGRESSION", description="Predict continuous values from features",
            domain="feature_matrix", hidden_structure="statistical_fitting",
            constraints={"n": 10**4, "d": 100}, best_algorithm="linear_regression",
            solved_count=0, difficulty=0.5, solution_history=[]),
        ProblemNode(signature="CLUSTERING", description="Group data points by similarity",
            domain="feature_matrix", hidden_structure="statistical_separation",
            constraints={"n": 10**4, "k": 10}, best_algorithm="kmeans",
            solved_count=0, difficulty=0.5, solution_history=[]),
        ProblemNode(signature="NLP", description="Process and analyze text",
            domain="text", hidden_structure="sequential",
            constraints={"n": 10**4}, best_algorithm="tokenizer",
            solved_count=0, difficulty=0.4, solution_history=[]),
        ProblemNode(signature="GRAPH", description="Analyze graph structure and properties",
            domain="graph", hidden_structure="graph_connectivity",
            constraints={"n": 10**4}, best_algorithm="bfs",
            solved_count=0, difficulty=0.4, solution_history=[]),
        ProblemNode(signature="STRING", description="Process and analyze strings",
            domain="text", hidden_structure="sequential",
            constraints={"n": 10**5}, best_algorithm="rabin_karp",
            solved_count=0, difficulty=0.3, solution_history=[]),
        ProblemNode(signature="DYNAMIC_PROGRAMMING", description="Solve optimization with overlapping subproblems",
            domain="numbers", hidden_structure="optimal_substructure",
            constraints={"n": 10**3}, best_algorithm="knapsack",
            solved_count=0, difficulty=0.7, solution_history=[]),
        ProblemNode(signature="TREE", description="Operate on tree data structures",
            domain="tree", hidden_structure="hierarchical",
            constraints={"n": 10**5}, best_algorithm="bst_operations",
            solved_count=0, difficulty=0.4, solution_history=[]),
        ProblemNode(signature="MATH", description="Mathematical computation",
            domain="numbers", hidden_structure="algebraic",
            constraints={"n": 10**9}, best_algorithm="gcd",
            solved_count=0, difficulty=0.3, solution_history=[]),
        ProblemNode(signature="IMAGE", description="Process and analyze images",
            domain="image", hidden_structure="spatial",
            constraints={"n": 10**6}, best_algorithm="convolution",
            solved_count=0, difficulty=0.5, solution_history=[]),
        ProblemNode(signature="BACKTRACKING", description="Search solution space with constraints",
            domain="numbers", hidden_structure="constraint_satisfaction",
            constraints={"n": 20}, best_algorithm="permutation",
            solved_count=0, difficulty=0.6, solution_history=[]),
        ProblemNode(signature="GREEDY", description="Make locally optimal choices",
            domain="numbers", hidden_structure="greedy_exchange",
            constraints={"n": 10**5}, best_algorithm="huffman",
            solved_count=0, difficulty=0.4, solution_history=[]),
    ]
