# youwe0/visualgorithm architecture

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

- Interactive diagram: https://gitdiagram.com/youwe0/visualgorithm
- Repository: https://github.com/youwe0/visualgorithm

## Overview

##### Project type and purpose
- This is a front-end heavy, single-page React application (built with Vite) that visualizes algorithms (sorting, searching, pathfinding, Conway’s Life, etc.).
- It runs entirely in the browser, served as static assets (hosted on Netlify).

##### File structure
- Top-level files:
- package.json, package-lock.json (npm dependencies)
- vite.config.js (build tool configuration)
- .gitignore, eslint.config.js (repo/config)
- index.html (entry HTML)
- public/: static asset (MP3 sound effect).
- src/: source code subdivided into
- Algorithms/ (pure logic modules: Astar.js, BubbleSort.js, etc.)
- Utils/GenerateArray.js (helper to create arrays)
- components/ (React UI components: Navbar, Controls, SortingVisualizer, PathfindingVisualizer, etc.)
- App.jsx, main.jsx (app entrypoints), App.css, index.css

##### README
- Confirms the live demo and responsive design goals.
- No backend or database; purely client-side.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Build & Dev Tooling"
        Node["Node.js & npm"]:::build
        Vite["Vite bundler (vite.config.js)"]:::build
        Pkg["package.json / package-lock.json"]:::build
        Node --> Vite
        click Vite "https://github.com/youwe0/visualgorithm/blob/main/vite.config.js"
        click Pkg "https://github.com/youwe0/visualgorithm/blob/main/package.json"
        click Pkg "https://github.com/youwe0/visualgorithm/blob/main/package-lock.json"
    end

    subgraph "Hosting / CDN"
        Netlify["Netlify CDN"]:::hosting
    end

    subgraph "Browser (Client Runtime)"
        Browser["User's Browser"]:::runtime
        Netlify -->|"serves static assets"| Browser

        subgraph "React Application"
            HTML["index.html"]:::runtime
            Main["main.jsx"]:::runtime
            App["App.jsx"]:::runtime
            HTML --> Main --> App
            click HTML "https://github.com/youwe0/visualgorithm/blob/main/index.html"
            click Main "https://github.com/youwe0/visualgorithm/blob/main/src/main.jsx"
            click App "https://github.com/youwe0/visualgorithm/blob/main/src/App.jsx"

            subgraph "UI Components"
                Navbar["Navbar.jsx"]:::runtime
                Landing["Landing.jsx"]:::runtime
                Controls["Controls.jsx"]:::runtime
                Footer["Footer.jsx"]:::runtime
                SortingVis["SortingVisualizer.jsx"]:::runtime
                SearchVis["SearchVisualizer.jsx"]:::runtime
                PathVis["PathfindingVisualizer.jsx"]:::runtime
                LifeVis["Lifegame.jsx"]:::runtime
                click Navbar "https://github.com/youwe0/visualgorithm/blob/main/src/components/Navbar.jsx"
                click Landing "https://github.com/youwe0/visualgorithm/blob/main/src/components/Landing.jsx"
                click Controls "https://github.com/youwe0/visualgorithm/blob/main/src/components/Controls.jsx"
                click Footer "https://github.com/youwe0/visualgorithm/blob/main/src/components/Footer.jsx"
                click SortingVis "https://github.com/youwe0/visualgorithm/blob/main/src/components/SortingVisualizer.jsx"
                click SearchVis "https://github.com/youwe0/visualgorithm/blob/main/src/components/SearchVisualizer.jsx"
                click PathVis "https://github.com/youwe0/visualgorithm/blob/main/src/components/PathfindingVisualizer.jsx"
                click LifeVis "https://github.com/youwe0/visualgorithm/blob/main/src/components/Lifegame.jsx"
            end

            subgraph "Algorithm Modules"
                subgraph "Sorting Algorithms"
                    SortDir["src/Algorithms/Sorting/"]:::runtime
                    Bubble["BubbleSort.js"]:::runtime
                    Merge["MergeSort.js"]:::runtime
                    Selection["SelectionSort.js"]:::runtime
                    SortDir --> Bubble & Merge & Selection
                    click SortDir "https://github.com/youwe0/visualgorithm/tree/main/src/Algorithms/Sorting/"
                    click Bubble "https://github.com/youwe0/visualgorithm/blob/main/src/Algorithms/Sorting/BubbleSort.js"
                    click Merge "https://github.com/youwe0/visualgorithm/blob/main/src/Algorithms/Sorting/MergeSort.js"
                    click Selection "https://github.com/youwe0/visualgorithm/blob/main/src/Algorithms/Sorting/SelectionSort.js"
                end

                subgraph "Searching Algorithms"
                    SearchDir["src/Algorithms/Searching/"]:::runtime
                    Binary["BinarySearch.js"]:::runtime
                    Jump["Jump.js"]:::runtime
                    SearchDir --> Binary & Jump
                    click SearchDir "https://github.com/youwe0/visualgorithm/tree/main/src/Algorithms/Searching/"
                    click Binary "https://github.com/youwe0/visualgorithm/blob/main/src/Algorithms/Searching/BinarySearch.js"
                    click Jump "https://github.com/youwe0/visualgorithm/blob/main/src/Algorithms/Searching/Jump.js"
                end

                subgraph "Pathfinding Algorithms"
                    PathDir["src/Algorithms/Pathfinding/"]:::runtime
                    Astar["Astar.js"]:::runtime
                    Bfs["Bfs.js"]:::runtime
                    Dfs["Dfs.js"]:::runtime
                    PathDir --> Astar & Bfs & Dfs
                    click PathDir "https://github.com/youwe0/visualgorithm/tree/main/src/Algorithms/Pathfinding/"
                    click Astar "https://github.com/youwe0/visualgorithm/blob/main/src/Algorithms/Pathfinding/Astar.js"
                    click Bfs "https://github.com/youwe0/visualgorithm/blob/main/src/Algorithms/Pathfinding/Bfs.js"
                    click Dfs "https://github.com/youwe0/visualgorithm/blob/main/src/Algorithms/Pathfinding/Dfs.js"
                end
            end

            subgraph "Utilities"
                UtilsDir["src/Utils/"]:::runtime
                GenArr["GenerateArray.js"]:::runtime
                UtilsDir --> GenArr
                click UtilsDir "https://github.com/youwe0/visualgorithm/tree/main/src/Utils/"
                click GenArr "https://github.com/youwe0/visualgorithm/blob/main/src/Utils/GenerateArray.js"
            end

            subgraph "Static Assets"
                Public["public/"]:::asset
                Sound["Sound Effect.mp3"]:::asset
                Public --> Sound
                click Public "https://github.com/youwe0/visualgorithm/tree/main/public/"
                click Sound "https://github.com/youwe0/visualgorithm/blob/main/public/Sound Effect - Tun Tun Tuuuuuuun - TOP 7 sound effects.mp3"
            end

            Controls -->|"triggers"| SortingVis
            Controls -->|"triggers"| SearchVis
            Controls -->|"triggers"| PathVis
            Controls -->|"triggers"| LifeVis

            SortingVis -->|"calls"| Bubble & Merge & Selection
            SearchVis -->|"calls"| Binary & Jump
            PathVis -->|"calls"| Astar & Bfs & Dfs

            SortingVis -->|"uses"| GenArr
            SearchVis -->|"uses"| GenArr
            PathVis -->|"uses"| GenArr
            LifeVis -->|"uses"| GenArr

            SortingVis -->|"plays"| Sound
            SearchVis -->|"plays"| Sound
            PathVis -->|"plays"| Sound
            LifeVis -->|"plays"| Sound
        end
    end

    subgraph "Build & Dev Tooling"
        Node --> Vite
    end

    Vite -->|"outputs bundles"| Netlify

    classDef build fill:#cce5ff,stroke:#0056b3,color:#004085
    classDef hosting fill:#d4edda,stroke:#155724,color:#155724
    classDef runtime fill:#fff3cd,stroke:#856404,color:#856404
    classDef asset fill:#e2e3e5,stroke:#d6d8db,color:#818182
```
