# dsk-dev-ai/algorithm-discovery-engine architecture

> Architecture diagram of the GitHub repository dsk-dev-ai/algorithm-discovery-engine, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dsk-dev-ai/algorithm-discovery-engine
- Repository: https://github.com/dsk-dev-ai/algorithm-discovery-engine

## Overview

This repository combines a four-language algorithms/data-structures catalog with two discovery tools: one ranks mathematical patterns in integer sequences, and another synthesizes candidate algorithms from examples and verifies them with fuzz inputs. The desktop GUI presents those engines through headless GUI logic. The README documents the language tiers and product capabilities; the sampled source and SOURCE INDEX show the internal calls noted below. The catalog data file is not in the supplied tree, so it is not represented as a repository node.

Main entry points: [`src/synth/discovery.py`](https://github.com/dsk-dev-ai/algorithm-discovery-engine/blob/main/src/synth/discovery.py) (Verify And Classify), [`src/algo_discovery/engine.py`](https://github.com/dsk-dev-ai/algorithm-discovery-engine/blob/main/src/algo_discovery/engine.py) (Sequence Ranking), [`src/synth/search.py`](https://github.com/dsk-dev-ai/algorithm-discovery-engine/blob/main/src/synth/search.py) (Candidate Search), [`src/gui/core.py`](https://github.com/dsk-dev-ai/algorithm-discovery-engine/blob/main/src/gui/core.py) (Headless GUI Logic)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_langs["Language Tiers"]
  node_py_alg["Python Algorithms<br/>[problems.py]"]
  node_py_alg_adv["Python Advanced Algorithms"]
  node_py_ds["Python Structures<br/>[structures.py]"]
  node_py_ds_adv["Python Advanced Structures"]
  node_java_alg["Java Algorithms<br/>[Solutions.java]"]
  node_java_ds["Java Structures<br/>[Structures.java]"]
  node_cpp_alg["C++ Algorithms<br/>[solutions.hpp]"]
  node_cpp_ds["C++ Structures<br/>[structures.hpp]"]
  node_rust_alg["Rust Algorithms<br/>[solutions.rs]"]
  node_rust_ds["Rust Structures<br/>[structures.rs]"]
end

subgraph group_synth["Algorithm Synthesis"]
  node_synth_corpus["Targets And Oracles<br/>[corpus.py]"]
  node_synth_grammar["Search Grammar<br/>[grammar.py]"]
  node_synth_search["Candidate Search<br/>[search.py]"]
  node_synth_run["Verify And Classify<br/>[discovery.py]"]
  node_discovered["Discovered Solutions"]
end

subgraph group_patterns["Pattern Discovery"]
  node_pattern_engine["Sequence Ranking<br/>[engine.py]"]
  node_hypotheses["Built-in Hypotheses<br/>[hypotheses.py]"]
  node_pattern_models["Sequence And Results<br/>[models.py]"]
  node_pattern_features["Sequence Features<br/>[features.py]"]
end

subgraph group_gui["Desktop GUI"]
  node_gui_app["Tkinter Interface<br/>[app.py]"]
  node_gui_core["Headless GUI Logic<br/>[core.py]"]
end

node_user(("Engineer"))

node_user -->|"submits sequence"| node_pattern_engine
node_user -->|"provides examples"| node_synth_run
node_user -->|"launches"| node_gui_app
node_synth_run -->|"requests candidates"| node_synth_search
node_synth_run -->|"loads targets and fuzz"| node_synth_corpus
node_synth_search -->|"reads examples"| node_synth_corpus
node_synth_search -.->|"enumerates programs"| node_synth_grammar
node_synth_run -->|"writes solutions"| node_discovered
node_pattern_engine -->|"evaluates hypotheses"| node_hypotheses
node_pattern_engine -->|"builds ranked result"| node_pattern_models
node_hypotheses -->|"returns scores"| node_pattern_models
node_pattern_features -->|"uses sequence model"| node_pattern_models
node_gui_app -->|"renders helper results"| node_gui_core
node_gui_core -->|"runs pattern discovery"| node_pattern_engine
node_gui_core -->|"runs algorithm discovery"| node_synth_run

click node_py_alg "https://github.com/dsk-dev-ai/algorithm-discovery-engine/blob/main/src/ads/problems.py"
click node_py_alg_adv "https://github.com/dsk-dev-ai/algorithm-discovery-engine/blob/main/src/ads/problems_advanced.py"
click node_py_ds "https://github.com/dsk-dev-ai/algorithm-discovery-engine/blob/main/src/ads/structures.py"
click node_py_ds_adv "https://github.com/dsk-dev-ai/algorithm-discovery-engine/blob/main/src/ads/structures_advanced.py"
click node_java_alg "https://github.com/dsk-dev-ai/algorithm-discovery-engine/blob/main/languages/java/src/ads/Solutions.java"
click node_java_ds "https://github.com/dsk-dev-ai/algorithm-discovery-engine/blob/main/languages/java/src/ads/Structures.java"
click node_cpp_alg "https://github.com/dsk-dev-ai/algorithm-discovery-engine/blob/main/languages/cpp/include/ads/solutions.hpp"
click node_cpp_ds "https://github.com/dsk-dev-ai/algorithm-discovery-engine/blob/main/languages/cpp/include/ads/structures.hpp"
click node_rust_alg "https://github.com/dsk-dev-ai/algorithm-discovery-engine/blob/main/languages/rust/src/solutions.rs"
click node_rust_ds "https://github.com/dsk-dev-ai/algorithm-discovery-engine/blob/main/languages/rust/src/structures.rs"
click node_synth_corpus "https://github.com/dsk-dev-ai/algorithm-discovery-engine/blob/main/src/synth/corpus.py"
click node_synth_grammar "https://github.com/dsk-dev-ai/algorithm-discovery-engine/blob/main/src/synth/grammar.py"
click node_synth_search "https://github.com/dsk-dev-ai/algorithm-discovery-engine/blob/main/src/synth/search.py"
click node_synth_run "https://github.com/dsk-dev-ai/algorithm-discovery-engine/blob/main/src/synth/discovery.py"
click node_discovered "https://github.com/dsk-dev-ai/algorithm-discovery-engine/tree/main/catalog/discoveries/solutions"
click node_pattern_engine "https://github.com/dsk-dev-ai/algorithm-discovery-engine/blob/main/src/algo_discovery/engine.py"
click node_hypotheses "https://github.com/dsk-dev-ai/algorithm-discovery-engine/blob/main/src/algo_discovery/hypotheses.py"
click node_pattern_models "https://github.com/dsk-dev-ai/algorithm-discovery-engine/blob/main/src/algo_discovery/models.py"
click node_pattern_features "https://github.com/dsk-dev-ai/algorithm-discovery-engine/blob/main/src/algo_discovery/features.py"
click node_gui_app "https://github.com/dsk-dev-ai/algorithm-discovery-engine/blob/main/src/gui/app.py"
click node_gui_core "https://github.com/dsk-dev-ai/algorithm-discovery-engine/blob/main/src/gui/core.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_py_alg,node_py_alg_adv,node_py_ds,node_py_ds_adv,node_java_alg,node_java_ds,node_cpp_alg,node_cpp_ds,node_rust_alg,node_rust_ds toneBlue
class node_synth_corpus,node_synth_grammar,node_synth_search,node_synth_run,node_discovered toneAmber
class node_pattern_engine,node_hypotheses,node_pattern_models,node_pattern_features toneMint
class node_gui_app,node_gui_core toneRose
class node_user toneIndigo
```

## Components

### Language Tiers

- [Python Algorithms](https://github.com/dsk-dev-ai/algorithm-discovery-engine/blob/main/src/ads/problems.py): `src/ads/problems.py`
- [Python Advanced Algorithms](https://github.com/dsk-dev-ai/algorithm-discovery-engine/blob/main/src/ads/problems_advanced.py): `src/ads/problems_advanced.py`
- [Python Structures](https://github.com/dsk-dev-ai/algorithm-discovery-engine/blob/main/src/ads/structures.py): `src/ads/structures.py`
- [Python Advanced Structures](https://github.com/dsk-dev-ai/algorithm-discovery-engine/blob/main/src/ads/structures_advanced.py): `src/ads/structures_advanced.py`
- [Java Algorithms](https://github.com/dsk-dev-ai/algorithm-discovery-engine/blob/main/languages/java/src/ads/Solutions.java): `languages/java/src/ads/Solutions.java`
- [Java Structures](https://github.com/dsk-dev-ai/algorithm-discovery-engine/blob/main/languages/java/src/ads/Structures.java): `languages/java/src/ads/Structures.java`
- [C++ Algorithms](https://github.com/dsk-dev-ai/algorithm-discovery-engine/blob/main/languages/cpp/include/ads/solutions.hpp): `languages/cpp/include/ads/solutions.hpp`
- [C++ Structures](https://github.com/dsk-dev-ai/algorithm-discovery-engine/blob/main/languages/cpp/include/ads/structures.hpp): `languages/cpp/include/ads/structures.hpp`
- [Rust Algorithms](https://github.com/dsk-dev-ai/algorithm-discovery-engine/blob/main/languages/rust/src/solutions.rs): `languages/rust/src/solutions.rs`
- [Rust Structures](https://github.com/dsk-dev-ai/algorithm-discovery-engine/blob/main/languages/rust/src/structures.rs): `languages/rust/src/structures.rs`

### Algorithm Synthesis

- [Targets And Oracles](https://github.com/dsk-dev-ai/algorithm-discovery-engine/blob/main/src/synth/corpus.py): `src/synth/corpus.py`
- [Search Grammar](https://github.com/dsk-dev-ai/algorithm-discovery-engine/blob/main/src/synth/grammar.py): `src/synth/grammar.py`
- [Candidate Search](https://github.com/dsk-dev-ai/algorithm-discovery-engine/blob/main/src/synth/search.py): `src/synth/search.py`
- [Verify And Classify](https://github.com/dsk-dev-ai/algorithm-discovery-engine/blob/main/src/synth/discovery.py): `src/synth/discovery.py`
- [Discovered Solutions](https://github.com/dsk-dev-ai/algorithm-discovery-engine/tree/main/catalog/discoveries/solutions): `catalog/discoveries/solutions`

### Pattern Discovery

- [Sequence Ranking](https://github.com/dsk-dev-ai/algorithm-discovery-engine/blob/main/src/algo_discovery/engine.py): `src/algo_discovery/engine.py`
- [Built-in Hypotheses](https://github.com/dsk-dev-ai/algorithm-discovery-engine/blob/main/src/algo_discovery/hypotheses.py): `src/algo_discovery/hypotheses.py`
- [Sequence And Results](https://github.com/dsk-dev-ai/algorithm-discovery-engine/blob/main/src/algo_discovery/models.py): `src/algo_discovery/models.py`
- [Sequence Features](https://github.com/dsk-dev-ai/algorithm-discovery-engine/blob/main/src/algo_discovery/features.py): `src/algo_discovery/features.py`

### Desktop GUI

- [Tkinter Interface](https://github.com/dsk-dev-ai/algorithm-discovery-engine/blob/main/src/gui/app.py): `src/gui/app.py`
- [Headless GUI Logic](https://github.com/dsk-dev-ai/algorithm-discovery-engine/blob/main/src/gui/core.py): `src/gui/core.py`

### Other components

- **Engineer**

## Connections

- Engineer → Sequence Ranking: submits sequence (evidence: `README.md`)
- Engineer → Verify And Classify: provides examples (evidence: `README.md`)
- Engineer → Tkinter Interface: launches (evidence: `README.md`)
- Verify And Classify → Candidate Search: requests candidates (evidence: `src/synth/discovery.py`)
- Verify And Classify → Targets And Oracles: loads targets and fuzz (evidence: `src/synth/discovery.py`)
- Candidate Search → Targets And Oracles: reads examples (evidence: `src/synth/search.py`)
- Candidate Search → Search Grammar: enumerates programs
- Verify And Classify → Discovered Solutions: writes solutions (evidence: `README.md`)
- Sequence Ranking → Built-in Hypotheses: evaluates hypotheses (evidence: `src/algo_discovery/engine.py`)
- Sequence Ranking → Sequence And Results: builds ranked result (evidence: `src/algo_discovery/engine.py`)
- Built-in Hypotheses → Sequence And Results: returns scores (evidence: `src/algo_discovery/hypotheses.py`)
- Sequence Features → Sequence And Results: uses sequence model (evidence: `src/algo_discovery/features.py`)
- Tkinter Interface → Headless GUI Logic: renders helper results (evidence: `src/gui/app.py`)
- Headless GUI Logic → Sequence Ranking: runs pattern discovery (evidence: `src/gui/core.py`)
- Headless GUI Logic → Verify And Classify: runs algorithm discovery (evidence: `src/gui/core.py`)
