# andtsa/bsc_thesis architecture

> Architecture diagram of the GitHub repository andtsa/bsc_thesis, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/andtsa/bsc_thesis
- Repository: https://github.com/andtsa/bsc_thesis

## Overview

##### Project Type and Purpose
- It is a research-oriented, multi-crate Rust application that:
- Implements core ranking definitions and Kendall’s τ computations (lib/)
- Provides two solvers (graph-based and brute-force) as CLI tools (solver/)
- Verifies solver outputs against reference data (verifier/)
- Runs end-to-end evaluations over CSVs (eval/)
- Generates R-based plots of results (plots/)
- Holds reference solution sets (solutions/).

##### Main Components
- Core Library (lib/)
- Solver CLI (solver/)
- Graph-based and brute-force algorithms
- Reference Solutions (solutions/)
- Verifier CLI (verifier/)
- Evaluation Tool (eval/)
- Plotting Scripts (plots/)

##### Interactions & Data Flows
a. Input data (rankings CSV) → Solver CLI
b. Solver CLI uses Core Library to compute τmin/τmax → writes solver output (CSV)
c. Reference Solutions crate holds “ground truth” solution data → consumed by Verifier
d. Verifier CLI reads solver output + reference solutions → emits verification report
e. Eval tool (eval/) orchestrates repeated solver+verifier runs over datasets → aggregates results
f. Plotting scripts (plots/*.R) read aggregated results (CSV) → output figures for the paper

##### Architectural Patterns & Design Principles
- Modular monorepo: each Cargo crate is a reusable module.
- CLI-Library separation: business logic in lib/, interfaces in solver/ and verifier/.
- Data-flow pipeline: clear stages (solve → verify → evaluate → plot).
- Single-responsibility per crate.

##### Key Technologies & Frameworks
- Rust/Cargo for all core components
- CSV I/O (serde, csv crates)
- Graph library for graph-based algorithm (in solver/)
- R for statistical plotting (in plots/)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Data Stores
    raw["Raw Rankings CSV"]:::data
    solOut["Solver Output CSV"]:::data
    verReport["Verification Report"]:::data
    aggRes["Aggregated Results CSV"]:::data
    figures["Figures"]:::data

    %% Crate Components
    subgraph "Rust Components"
        lib["lib (Core Library)"]:::libc
        solver["solver (Solver CLI)"]:::solverc
        solutions["solutions (Reference Data)"]:::solc
        verifier["verifier (Verifier CLI)"]:::verificar
        eval["eval (Evaluation Orchestrator)"]:::evalc
    end

    %% R Scripts
    subgraph "Plotting Scripts"
        script1["synth-dist.R"]:::plotsc
        script2["synth-heat.R"]:::plotsc
    end

    %% Data Flows
    raw -->|"input rankings"| solver
    solver -->|"compute τmin/τmax"| solOut
    solOut -->|"solver output"| verifier
    solutions -->|"reference data"| verifier
    verifier -->|"verification report"| verReport
    eval -.-> solver
    eval -.-> verifier
    eval -->|"aggregate results"| aggRes
    aggRes -->|"reads results"| script1
    aggRes -->|"reads results"| script2
    script1 -->|"generate plots"| figures
    script2 -->|"generate plots"| figures

    %% Code Dependencies
    solver -.->|"depends on"| lib
    verifier -.->|"depends on"| lib
    eval -.->|"depends on"| solver
    eval -.->|"depends on"| verifier

    %% Click Events
    click lib "https://github.com/andtsa/bsc_thesis/blob/main/lib/Cargo.toml"
    click solver "https://github.com/andtsa/bsc_thesis/blob/main/solver/Cargo.toml"
    click solutions "https://github.com/andtsa/bsc_thesis/blob/main/solutions/Cargo.toml"
    click verifier "https://github.com/andtsa/bsc_thesis/blob/main/verifier/Cargo.toml"
    click eval "https://github.com/andtsa/bsc_thesis/blob/main/eval/Cargo.toml"
    click script1 "https://github.com/andtsa/bsc_thesis/blob/main/plots/synth-dist.R"
    click script2 "https://github.com/andtsa/bsc_thesis/blob/main/plots/synth-heat.R"

    %% Styles
    classDef libc fill:#add8e6,stroke:#333,stroke-width:1px
    classDef solverc fill:#90ee90,stroke:#333,stroke-width:1px
    classDef solc fill:#d3d3d3,stroke:#333,stroke-width:1px
    classDef verificar fill:#ffa500,stroke:#333,stroke-width:1px
    classDef evalc fill:#9b5de5,stroke:#333,stroke-width:1px
    classDef plotsc fill:#e63946,stroke:#333,stroke-width:1px
    classDef data fill:#ffffff,stroke:#000,stroke-dasharray: 2 2,stroke-width:1px
```
