# bdkoepke/alib architecture

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

- Interactive diagram: https://gitdiagram.com/bdkoepke/alib
- Repository: https://github.com/bdkoepke/alib

## Overview

##### Main Components Organization

a) Core Language Components (src/lang/):
- Sub-components for:
- Basic Types (type.nw)
- Array Operations (array.nw)
- String Manipulation (string.nw)
- Mathematical Operations (math_extended.nw)
- Comparison & Equality (compare.nw, equals.nw)
- Sorting Algorithms (sort.nw)
- Hashing Functions (hash.nw)

b) Utility Data Structures (src/util/):
- Linear Data Structures
- Vector (vector.nw)
- Stack (stack.nw)
- Queue (queue.nw)
- Linked implementations (linked_stack.nw, linked_queue.nw)

- Tree Structures
- Binary Tree (binary_tree.nw)
- Red-Black Tree (red_black_tree.nw)
- Tree Node implementations (binary_node.nw, node.nw)

- Graph Structures
- Base Graph (graph.nw)
- Matrix Graph (matrix_graph.nw)
- Linked Graph (linked_graph.nw)
- Graph Visitor (graph_visitor.nw)

- Container Abstractions
- Iterator (iterator.nw)
- Container (container.nw)
- Range Container (range_container.nw)
- Array Container (array_container.nw)

##### Specific Elements

a) Interface Hierarchies:
- Inheritance relationships between interfaces (e.g., Container → Iterable)
- Demonstrate implementation relationships

b) Algorithm Categories:
- Related algorithms together
- Dependencies on data structures

##### Notes for Implementation

- Use UML-like notation for class/interface relationships
- Cardinality where relevant
- Template/generic type relationships
- Public interfaces vs. implementation details

Remember to include bidirectional relationships where appropriate, such as between containers and iterators, and show how the testing framework validates each component.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef core fill:#b3d9ff,stroke:#333,stroke-width:2px
    classDef basic fill:#90EE90,stroke:#333,stroke-width:2px
    classDef complex fill:#FFB366,stroke:#333,stroke-width:2px
    classDef test fill:#E6E6E6,stroke:#333,stroke-width:2px

    %% Legend
    subgraph Legend
        L1[Core Language Components]:::core
        L2[Basic Data Structures]:::basic
        L3[Complex Data Structures]:::complex
        L4[Testing Components]:::test
    end

    %% Core Language Components
    subgraph CoreLanguage
        Types["Basic Types"]:::core
        Array["Array Operations"]:::core
        String["String Manipulation"]:::core
        Math["Mathematical Operations"]:::core
        Compare["Comparison"]:::core
        Equals["Equality"]:::core
        Sort["Sorting Algorithms"]:::core
        Hash["Hashing Functions"]:::core
    end

    %% Basic Data Structures
    subgraph LinearStructures
        Vector["Vector"]:::basic
        Stack["Stack"]:::basic
        Queue["Queue"]:::basic
        LinkedStack["Linked Stack"]:::basic
        LinkedQueue["Linked Queue"]:::basic
    end

    %% Container Abstractions
    subgraph Containers
        Iterator["Iterator"]:::basic
        Container["Container"]:::basic
        RangeContainer["Range Container"]:::basic
        ArrayContainer["Array Container"]:::basic
    end

    %% Complex Data Structures
    subgraph TreeStructures
        BinaryTree["Binary Tree"]:::complex
        RedBlackTree["Red-Black Tree"]:::complex
        BinaryNode["Binary Node"]:::complex
        BaseNode["Base Node"]:::complex
    end

    subgraph GraphStructures
        BaseGraph["Base Graph"]:::complex
        MatrixGraph["Matrix Graph"]:::complex
        LinkedGraph["Linked Graph"]:::complex
        GraphVisitor["Graph Visitor"]:::complex
    end

    %% Testing Framework
    subgraph Testing
        MainTest["Main Test"]:::test
        ContainerTests["Container Tests"]:::test
        SortTests["Sort Tests"]:::test
    end

    %% Relationships
    Container --> Iterator
    RangeContainer --> Container
    ArrayContainer --> Container
    Vector --> ArrayContainer
    Stack --> Container
    Queue --> Container
    LinkedStack --> Stack
    LinkedQueue --> Queue
    BinaryTree --> Container
    RedBlackTree --> BinaryTree
    BinaryNode --> BaseNode
    BaseGraph --> Container
    MatrixGraph --> BaseGraph
    LinkedGraph --> BaseGraph
    GraphVisitor --> BaseGraph

    %% Testing relationships
    ContainerTests --> Container
    SortTests --> Sort

    %% Click events
    click Types "https://github.com/bdkoepke/alib/blob/master/src/lang/type.nw"
    click Array "https://github.com/bdkoepke/alib/blob/master/src/lang/array.nw"
    click String "https://github.com/bdkoepke/alib/blob/master/src/lang/string.nw"
    click Math "https://github.com/bdkoepke/alib/blob/master/src/lang/math_extended.nw"
    click Compare "https://github.com/bdkoepke/alib/blob/master/src/lang/compare.nw"
    click Equals "https://github.com/bdkoepke/alib/blob/master/src/lang/equals.nw"
    click Sort "https://github.com/bdkoepke/alib/blob/master/src/lang/sort.nw"
    click Hash "https://github.com/bdkoepke/alib/blob/master/src/lang/hash.nw"
    click Vector "https://github.com/bdkoepke/alib/blob/master/src/util/vector.nw"
    click Stack "https://github.com/bdkoepke/alib/blob/master/src/util/stack.nw"
    click Queue "https://github.com/bdkoepke/alib/blob/master/src/util/queue.nw"
    click LinkedStack "https://github.com/bdkoepke/alib/blob/master/src/util/linked_stack.nw"
    click LinkedQueue "https://github.com/bdkoepke/alib/blob/master/src/util/linked_queue.nw"
    click BinaryTree "https://github.com/bdkoepke/alib/blob/master/src/util/binary_tree.nw"
    click RedBlackTree "https://github.com/bdkoepke/alib/blob/master/src/util/red_black_tree.nw"
    click BinaryNode "https://github.com/bdkoepke/alib/blob/master/src/util/binary_node.nw"
    click BaseNode "https://github.com/bdkoepke/alib/blob/master/src/util/node.nw"
    click BaseGraph "https://github.com/bdkoepke/alib/blob/master/src/util/graph.nw"
    click MatrixGraph "https://github.com/bdkoepke/alib/blob/master/src/util/matrix_graph.nw"
    click LinkedGraph "https://github.com/bdkoepke/alib/blob/master/src/util/linked_graph.nw"
    click GraphVisitor "https://github.com/bdkoepke/alib/blob/master/src/util/graph_visitor.nw"
    click Iterator "https://github.com/bdkoepke/alib/blob/master/src/util/iterator.nw"
    click Container "https://github.com/bdkoepke/alib/blob/master/src/util/container.nw"
    click RangeContainer "https://github.com/bdkoepke/alib/blob/master/src/util/range_container.nw"
    click ArrayContainer "https://github.com/bdkoepke/alib/blob/master/src/util/array_container.nw"
    click MainTest "https://github.com/bdkoepke/alib/blob/master/src/test/test.nw"
    click ContainerTests "https://github.com/bdkoepke/alib/blob/master/src/test/test_container.nw"
    click SortTests "https://github.com/bdkoepke/alib/blob/master/src/test/test_sort.nw"
```
