# tinletrongcs/dsa_assignments architecture

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

- Interactive diagram: https://gitdiagram.com/tinletrongcs/dsa_assignments
- Repository: https://github.com/tinletrongcs/dsa_assignments

## Overview

##### Graph and Topological Sort Module
- Files: AbstractGraph.h, DGraphModel.h, UGraphModel.h, TopoSorter.h
- Purpose: Implement different graph models (perhaps directed and undirected) along with graph traversal and sorting (topological sort).

##### Machine Learning / Neural Network Module
- Files: MLPClassifier.cpp, IModel.cpp, Layer.cpp, FCLayer.cpp, along with activation function implementations (ReLU.cpp, Sigmoid.cpp, Tanh.cpp, Softmax.cpp) and loss functions (CrossEntropy.cpp)
- Purpose: These files indicate a simple neural network (likely a multilayer perceptron classifier) implementation. Layers (including fully connected ones) and activation functions are implemented explicitly.
- “Model Interface” and “MLPClassifier” for overall model management.
- “Layer” and “FCLayer” blocks to represent different abstraction levels in the NN.
- Activation function blocks (ReLU, Sigmoid, Tanh, Softmax) and a “Loss Function” (CrossEntropy) connected to the network layers.

##### Core Data Structures and Utilities Module
- Files: DLinkedList.h, DLinkedListSE.h, Queue.h, Stack.h, Heap.h, XArrayList.h, xMap.h, xtensor_lib.h
- Purpose: Provide custom implementations of fundamental data structures and possibly even a rudimentary tensor library (xtensor_lib.h) for handling multi-dimensional data arrays.
- Also present are dataset.h and dataloader.h, which likely support input processing (possibly feeding data into the ML module).

- For the Neural Network, indicate the flow from “Input Data” (coming from Dataset/Dataloader) through the network layers to output predictions and compute loss.
- Algorithm/Processing components (e.g., MLPClassifier, TopoSorter)
- Data structure implementations (e.g., DLinkedList, Queue, Stack)
- Utility or supporting components (e.g., Dataset / Dataloader, Tensor Utilities)
- Textual annotations where appropriate, for instance:
- “Graph Module” uses classical graph algorithms to support assignment objectives.
- “Neural Network Module” implements a simple MLP with built-in activation and loss functions.
- “Data Structures Module” provides all the underlying data management mechanisms required for algorithm implementation.

– For this project’s type (an educational repository with multiple assignments), detail every component because the design is intended to demonstrate understanding of both algorithm implementation and component reuse.
– If desired, include a “Main” section (even if implicit) to indicate how a driver function or test harness might integrate these modules during execution.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Graph Module
    subgraph "Graph Module"
        G1["Abstract Graph"]
        G2["Directed Graph Model"]
        G3["Undirected Graph Model"]
        G4["TopoSorter"]
    end

    %% Neural Network / ML Module
    subgraph "Neural Network / ML Module"
        NN1["Model Interface"]
        NN2["MLPClassifier"]
        subgraph "Layers"
            NN3["Layer"]
            NN4["FCLayer"]
        end
        subgraph "Activation Functions"
            NN5["ReLU"]
            NN6["Sigmoid"]
            NN7["Tanh"]
            NN8["Softmax"]
        end
        NN9["Loss Function (CrossEntropy)"]
    end

    %% Core Data Structures & Utilities
    subgraph "Core Data Structures & Utilities"
        subgraph "Linked Lists"
            DS1a["DLinkedList"]
            DS1b["DLinkedListSE"]
        end
        subgraph "Queue & Stack"
            DS2a["Queue"]
            DS2b["Stack"]
        end
        subgraph "Heap & ArrayList"
            DS3a["Heap"]
            DS3b["ArrayList"]
        end
        DS4["Map"]
        DS5["Tensor Utilities"]
        subgraph "Data Input"
            DS6a["Dataset"]
            DS6b["Dataloader"]
        end
    end

    %% Connections within Graph Module
    G4 -->|"uses"| G2
    G4 -->|"uses"| G3
    G2 -->|"derived_from"| G1
    G3 -->|"derived_from"| G1

    %% Connections within Neural Network / ML Module
    NN1 -->|"implements"| NN2
    NN2 -->|"builds"| NN3
    NN2 -->|"builds"| NN4
    NN3 -->|"activates"| NN5
    NN3 -->|"activates"| NN6
    NN3 -->|"activates"| NN7
    NN3 -->|"activates"| NN8
    NN4 -->|"activates"| NN5
    NN4 -->|"activates"| NN6
    NN4 -->|"activates"| NN7
    NN4 -->|"activates"| NN8
    NN5 -->|"feeds"| NN9
    NN6 -->|"feeds"| NN9
    NN7 -->|"feeds"| NN9
    NN8 -->|"feeds"| NN9

    %% Data flow from Data Structures to Neural Network
    DS6a -->|"supplies data"| NN2
    DS6b -->|"supplies data"| NN2

    %% Styles
    classDef algorithm fill:#fce4d6,stroke:#e67e22,stroke-width:2px;
    classDef data fill:#d5f5e3,stroke:#27ae60,stroke-width:2px;
    classDef utility fill:#d6eaf8,stroke:#3498db,stroke-width:2px;

    class G1,G2,G3,G4,NN1,NN2,NN3,NN4,NN5,NN6,NN7,NN8,NN9 algorithm;
    class DS1a,DS1b,DS2a,DS2b,DS3a,DS3b,DS4,DS5,DS6a,DS6b data;

    %% Click Events for Graph Module
    click G1 "https://github.com/tinletrongcs/dsa_assignments/blob/main/AbstractGraph.h"
    click G2 "https://github.com/tinletrongcs/dsa_assignments/blob/main/DGraphModel.h"
    click G3 "https://github.com/tinletrongcs/dsa_assignments/blob/main/UGraphModel.h"
    click G4 "https://github.com/tinletrongcs/dsa_assignments/blob/main/TopoSorter.h"

    %% Click Events for Neural Network / ML Module
    click NN1 "https://github.com/tinletrongcs/dsa_assignments/blob/main/IModel.cpp"
    click NN2 "https://github.com/tinletrongcs/dsa_assignments/blob/main/MLPClassifier.cpp"
    click NN3 "https://github.com/tinletrongcs/dsa_assignments/blob/main/Layer.cpp"
    click NN4 "https://github.com/tinletrongcs/dsa_assignments/blob/main/FCLayer.cpp"
    click NN5 "https://github.com/tinletrongcs/dsa_assignments/blob/main/ReLU.cpp"
    click NN6 "https://github.com/tinletrongcs/dsa_assignments/blob/main/Sigmoid.cpp"
    click NN7 "https://github.com/tinletrongcs/dsa_assignments/blob/main/Tanh.cpp"
    click NN8 "https://github.com/tinletrongcs/dsa_assignments/blob/main/Softmax.cpp"
    click NN9 "https://github.com/tinletrongcs/dsa_assignments/blob/main/CrossEntropy.cpp"

    %% Click Events for Core Data Structures & Utilities
    click DS1a "https://github.com/tinletrongcs/dsa_assignments/blob/main/DLinkedList.h"
    click DS1b "https://github.com/tinletrongcs/dsa_assignments/blob/main/DLinkedListSE.h"
    click DS2a "https://github.com/tinletrongcs/dsa_assignments/blob/main/Queue.h"
    click DS2b "https://github.com/tinletrongcs/dsa_assignments/blob/main/Stack.h"
    click DS3a "https://github.com/tinletrongcs/dsa_assignments/blob/main/Heap.h"
    click DS3b "https://github.com/tinletrongcs/dsa_assignments/blob/main/XArrayList.h"
    click DS4 "https://github.com/tinletrongcs/dsa_assignments/blob/main/xMap.h"
    click DS5 "https://github.com/tinletrongcs/dsa_assignments/blob/main/xtensor_lib.h"
    click DS6a "https://github.com/tinletrongcs/dsa_assignments/blob/main/dataset.h"
    click DS6b "https://github.com/tinletrongcs/dsa_assignments/blob/main/dataloader.h"
```
