# anudeep512/nsw-parallelisation architecture

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

- Interactive diagram: https://gitdiagram.com/anudeep512/nsw-parallelisation
- Repository: https://github.com/anudeep512/nsw-parallelisation

## Overview

##### Project type and purpose
- This is a C++‐based research/benchmarking tool that parallelises the NSW (Navigable Small World) graph search algorithm.
- It provides three modes of operation:
– seq.cpp: sequential build & query
– sam.cpp: static allocation of data chunks to threads
– dam.cpp: dynamic allocation of data chunks to threads

##### File structure
Top‐level items:
- Dataset/ : input text files (100.txt, 1000.txt, …)
- seq.cpp, sam.cpp, dam.cpp : three implementations of the same pipeline
- params.txt : configuration (e.g., graph parameters, thread counts)
- bash_1.sh, bash_2.sh, bash_3.sh : automation scripts for compiling/running each mode
- Reports & presentations (PDFs) for documentation

Architectural implications:
- A clear data‐processing pipeline: Data Loader → Graph Builder → Search Engine → Result Collector
- Two parallelization strategies distinguished only by how work is assigned to threads

##### README for additional insights
- The project focuses on two parallel strategies (SAM vs. DAM) vs. the baseline sequential version.
- Datasets vary in size to measure scaling and speed‐up.
- Scripts orchestrate compilation and runs with different inputs/parameters.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Orchestration Scripts"
        B1("bash_1.sh"):::script
        B2("bash_2.sh"):::script
        B3("bash_3.sh"):::script
    end

    subgraph "Runner Modules"
        S("Sequential Runner"):::sequential
        SAM("SAM Runner"):::parallel
        DAM("DAM Runner"):::parallel
    end

    B1 -->|"runs"| S
    B2 -->|"runs"| SAM
    B3 -->|"runs"| DAM

    subgraph "Pipeline Components"
        PM["Parameter Manager"]:::component
        DS["Dataset Input"]:::data
        GB["Graph Builder"]:::component
        SE["Search Engine"]:::component
        RA["Result Aggregator & Logger"]:::component
    end

    S --> PM
    SAM --> PM
    DAM --> PM

    PM --> DS
    DS --> GB
    GB --> SE

    subgraph "Search Engine Strategies"
        SE1("Sequential Search"):::sequential
        SE2("Static Allocator"):::allocator
        SE3("Dynamic Allocator"):::allocator
    end

    SE --> SE1
    SE --> SE2
    SE --> SE3

    SE1 --> RA
    SE2 --> RA
    SE3 --> RA

    RA -->|"outputs"| Logs["Logs (stdout/files)"]:::data

    subgraph "Documentation"
        Docs("Project Docs & Reports"):::doc
    end

    Docs -.-> B1

    click B1 "https://github.com/anudeep512/nsw-parallelisation/blob/main/bash_1.sh"
    click B2 "https://github.com/anudeep512/nsw-parallelisation/blob/main/bash_2.sh"
    click B3 "https://github.com/anudeep512/nsw-parallelisation/blob/main/bash_3.sh"
    click S "https://github.com/anudeep512/nsw-parallelisation/blob/main/seq.cpp"
    click SAM "https://github.com/anudeep512/nsw-parallelisation/blob/main/sam.cpp"
    click DAM "https://github.com/anudeep512/nsw-parallelisation/blob/main/dam.cpp"
    click PM "https://github.com/anudeep512/nsw-parallelisation/blob/main/params.txt"
    click DS "https://github.com/anudeep512/nsw-parallelisation/tree/main/Dataset/"
    click Docs "https://github.com/anudeep512/nsw-parallelisation/blob/main/README.md"

    classDef script fill:#AED6F1,stroke:#21618C,stroke-width:1px,shape:rect;
    classDef component fill:#ABEBC6,stroke:#1D8348,stroke-width:1px;
    classDef data fill:#F9E79F,stroke:#B7950B,stroke-width:1px,shape:cylinder;
    classDef sequential fill:#D2B4DE,stroke:#7D3C98,stroke-width:1px;
    classDef parallel fill:#F5CBA7,stroke:#B9770E,stroke-width:1px;
    classDef allocator fill:#F5B7B1,stroke:#943126,stroke-width:1px;
    classDef doc fill:#D5D8DC,stroke:#566573,stroke-width:1px;
```
