# pawelbeza/algoanalysis architecture

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

- Interactive diagram: https://gitdiagram.com/pawelbeza/algoanalysis
- Repository: https://github.com/pawelbeza/algoanalysis

## Overview

##### Major Modules/Components
- Sorting – Contains implementations for bubble sort, merge sort, quick sort, and a comparison against STL sort, with dedicated input files (small_input.txt, big_input.txt) and test harnesses.
- Dictionaries – Implements dictionary data structures using AVL trees and splay trees. It includes a large text file (The_bible.txt) and supports insertion and querying benchmarks contrasted with STL map behavior.
- Pattern Searching – Implements string search algorithms (BruteForce, KMP, Rabin-Karp) along with their respective test suites.
- Path Finding – Features an implementation of Dijkstra’s algorithm (note: spelled “Djikstra” in the code) packaged with its header, source files, and tests.
- karyHeap – Implements a heap data structure optimized for k‑ary heaps, including tests.

##### Relationships and Interactions
- Each module is self-contained with its own CMakeLists.txt, indicating that they are independently built units suitable for separate compilation and testing.
- The input files (e.g., The_bible.txt, big_input.txt, small_input.txt, test.txt) are external data sources fed into the corresponding testing harnesses.
- Tests (e.g., test.cpp and tests.cpp in each folder) interact with the source code to measure performance, which ultimately leads to the generation of benchmark charts (as described in the README).

##### Architectural Patterns and Design Principles
- Modularization – Each algorithm category is isolated into its own directory, promoting separation of concerns and allowing for independent development, testing, and benchmarking.
- Benchmarking & Comparison – The structure emphasizes dual paths: custom algorithm implementations versus STL equivalents, which is central when comparing execution times.
- Use of CMake – Each module has its own CMakeLists.txt; this signifies a standardized build system across the project, demonstrating reproducibility and modular builds.

##### Relevant Technologies/Frameworks
- Programming Language: C++
- Build System: CMake
- Benchmarking/Test Harnesses: Custom test files that execute and time algorithm performance.
- External Dependencies: Standard Template Library (STL) for comparisons.

##### Specific Elements to Incorporate
- Clear, descriptive labels for each component (e.g., “Sorting Module”, “Dictionary Module”, “Pattern Searching Module”, etc.).
- Algorithm implementations (e.g., rectangles for modules)

- Under each module, detail the specific algorithms and associated test/input files.
- Link the modules to a shared “Benchmark & Analysis” layer that symbolizes the performance comparison (as described in the README charts).
- That while each module is independent, they collectively serve the overarching purpose of algorithm analysis and performance benchmarking.

## Diagram (Mermaid)

```mermaid
flowchart TD
    Repo["AlgoAnalysis Repository"]:::repo
    BS["Build System (CMake)"]:::build
    BA["Benchmark & Analysis"]:::benchmark

    %% Sorting Module Subgraph
    subgraph "Sorting Module"
        SM["Sorting Module"]:::module
        S1["Bubble Sort"]:::algo
        S2["Merge Sort"]:::algo
        S3["Quick Sort"]:::algo
        S4["STL Sort Comparison"]:::algo
        SI1["big_input.txt"]:::input
        SI2["small_input.txt"]:::input
        ST["Test Harness (test.cpp)"]:::test

        SM --> S1
        SM --> S2
        SM --> S3
        SM --> S4
        S1 --> ST
        S2 --> ST
        S3 --> ST
        S4 --> ST
        SI1 --> ST
        SI2 --> ST
    end

    %% Dictionaries Module Subgraph
    subgraph "Dictionaries Module"
        DM["Dictionaries Module"]:::module
        D1["AVL Tree Dictionary"]:::algo
        D2["Splay Tree Dictionary"]:::algo
        DI1["The_bible.txt"]:::input
        DI2["input.txt"]:::input
        DT["Test Harness (test.cpp)"]:::test

        DM --> D1
        DM --> D2
        D1 --> DT
        D2 --> DT
        DI1 --> DT
        DI2 --> DT
    end

    %% Pattern Searching Module Subgraph
    subgraph "Pattern Searching Module"
        PM["Pattern Searching Module"]:::module
        P1["BruteForce"]:::algo
        P2["KMP"]:::algo
        P3["Rabin-Karp"]:::algo
        PT["Test Suite (tests.cpp)"]:::test

        PM --> P1
        PM --> P2
        PM --> P3
        P1 --> PT
        P2 --> PT
        P3 --> PT
    end

    %% Path Finding Module Subgraph
    subgraph "Path Finding Module"
        PFM["Path Finding Module"]:::module
        PF1["Djikstra Algorithm"]:::algo
        PFH["Djikstra.hpp"]:::algo
        PI["Input File (test.txt)"]:::input
        PFT["Test Suite (tests.cpp)"]:::test

        PFM --> PF1
        PFM --> PFH
        PF1 --> PFT
        PFH --> PFT
        PI --> PFT
    end

    %% k‑ary Heap Module Subgraph
    subgraph "k‑ary Heap Module"
        KM["k‑ary Heap Module"]:::module
        KH["k‑ary Heap"]:::algo
        KT["Test Harness (test.cpp)"]:::test

        KM --> KH
        KH --> KT
    end

    %% Connections from Repository to Modules
    Repo --> SM
    Repo --> DM
    Repo --> PM
    Repo --> PFM
    Repo --> KM

    %% Build System connecting to each Module
    BS --> SM
    BS --> DM
    BS --> PM
    BS --> PFM
    BS --> KM

    %% Modules output to Benchmark & Analysis
    SM --> BA
    DM --> BA
    PM --> BA
    PFM --> BA
    KM --> BA

    %% Click Events for Component Mappings
    click SM "https://github.com/pawelbeza/algoanalysis/tree/master/Sort/"
    click DM "https://github.com/pawelbeza/algoanalysis/tree/master/Dictionaries/"
    click PM "https://github.com/pawelbeza/algoanalysis/tree/master/Pattern Searching/"
    click PFM "https://github.com/pawelbeza/algoanalysis/tree/master/Path Finding/"
    click KM "https://github.com/pawelbeza/algoanalysis/tree/master/karyHeap/"

    %% Styles
    classDef repo fill:#ffd700,stroke:#333,stroke-width:2px;
    classDef module fill:#ffdab9,stroke:#333,stroke-width:1px;
    classDef algo fill:#add8e6,stroke:#333,stroke-width:1px;
    classDef input fill:#98fb98,stroke:#333,stroke-width:1px;
    classDef test fill:#ffb6c1,stroke:#333,stroke-width:1px;
    classDef build fill:#ffa500,stroke:#333,stroke-width:1px;
    classDef benchmark fill:#d3d3d3,stroke:#333,stroke-width:1px;
```
