# lucaspilla/sorting-algorithms-visualizer architecture

> Architecture diagram of the GitHub repository lucaspilla/sorting-algorithms-visualizer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lucaspilla/sorting-algorithms-visualizer
- Repository: https://github.com/lucaspilla/sorting-algorithms-visualizer

## Overview

This is a Pygame sorting visualizer. The principal workflow is to choose an algorithm and array settings, start the animation, and watch sorting steps represented by moving bars. The graph shows the documented user workflow and the sampled entry-point and registry relationships. Most algorithm implementations are grouped because their files are listed in the source index but were not excerpted; their individual internal calls are not inferred.

Main entry points: [`src/algs.py`](https://github.com/lucaspilla/sorting-algorithms-visualizer/blob/master/src/algs.py) (Algorithm registry), [`src/main.py`](https://github.com/lucaspilla/sorting-algorithms-visualizer/blob/master/src/main.py) (Visualizer entry point), [`src/display.py`](https://github.com/lucaspilla/sorting-algorithms-visualizer/blob/master/src/display.py) (Algorithm and settings controls), [`src/algorithms/timSort.py`](https://github.com/lucaspilla/sorting-algorithms-visualizer/blob/master/src/algorithms/timSort.py) (Timsort)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["User interface"]
  node_controls["Algorithm and settings controls<br/>[display.py]"]
  node_widgets["Input widgets<br/>[display.py]"]
  node_window["Window rendering<br/>[display.py]"]
end

subgraph group_runtime["Visualization runtime"]
  node_visualizer["Visualizer entry point<br/>[main.py]"]
  node_registry["Algorithm registry<br/>[algs.py]"]
  node_steps["Animation steps<br/>[main.py]"]
end

subgraph group_sorting["Sorting algorithms"]
  node_general["General sorting algorithms"]
  node_divide["Divide-and-merge sorts<br/>[mergeSort.py]"]
  node_heap["Heap sort<br/>[heapSort.py]"]
  node_radix["Radix sort<br/>[radixSort.py]"]
  node_shell["Shell sort<br/>[shellSort.py]"]
  node_strand["Strand sort<br/>[strandSort.py]"]
  node_tree["Tree sort<br/>[treeSort.py]"]
  node_timsort["Timsort<br/>[timSort.py]"]
  node_binary["Binary insertion helper"]
end

node_user(("User"))

node_user -.->|"sets options"| node_controls
node_controls -.->|"uses controls"| node_widgets
node_user -.->|"starts app"| node_visualizer
node_visualizer -->|"uses display"| node_window
node_visualizer -->|"imports registry"| node_registry
node_visualizer -.->|"drives animation"| node_steps
node_registry -->|"dispatches sorts"| node_general
node_registry -->|"dispatches sorts"| node_divide
node_registry -->|"dispatches sort"| node_heap
node_registry -->|"dispatches sort"| node_radix
node_registry -->|"dispatches sort"| node_shell
node_registry -->|"dispatches sort"| node_strand
node_registry -->|"dispatches sort"| node_tree
node_registry -->|"dispatches sort"| node_timsort
node_timsort -->|"calls search"| node_binary

click node_controls "https://github.com/lucaspilla/sorting-algorithms-visualizer/blob/master/src/display.py"
click node_widgets "https://github.com/lucaspilla/sorting-algorithms-visualizer/blob/master/src/display.py"
click node_visualizer "https://github.com/lucaspilla/sorting-algorithms-visualizer/blob/master/src/main.py"
click node_window "https://github.com/lucaspilla/sorting-algorithms-visualizer/blob/master/src/display.py"
click node_registry "https://github.com/lucaspilla/sorting-algorithms-visualizer/blob/master/src/algs.py"
click node_steps "https://github.com/lucaspilla/sorting-algorithms-visualizer/blob/master/src/main.py"
click node_general "https://github.com/lucaspilla/sorting-algorithms-visualizer/tree/master/src/algorithms"
click node_divide "https://github.com/lucaspilla/sorting-algorithms-visualizer/blob/master/src/algorithms/mergeSort.py"
click node_heap "https://github.com/lucaspilla/sorting-algorithms-visualizer/blob/master/src/algorithms/heapSort.py"
click node_radix "https://github.com/lucaspilla/sorting-algorithms-visualizer/blob/master/src/algorithms/radixSort.py"
click node_shell "https://github.com/lucaspilla/sorting-algorithms-visualizer/blob/master/src/algorithms/shellSort.py"
click node_strand "https://github.com/lucaspilla/sorting-algorithms-visualizer/blob/master/src/algorithms/strandSort.py"
click node_tree "https://github.com/lucaspilla/sorting-algorithms-visualizer/blob/master/src/algorithms/treeSort.py"
click node_timsort "https://github.com/lucaspilla/sorting-algorithms-visualizer/blob/master/src/algorithms/timSort.py"
click node_binary "https://github.com/lucaspilla/sorting-algorithms-visualizer/blob/master/src/algorithms/binaryInsertionSort.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_controls,node_widgets,node_window,node_user toneBlue
class node_visualizer,node_registry,node_steps toneAmber
class node_general,node_divide,node_heap,node_radix,node_shell,node_strand,node_tree,node_timsort,node_binary toneMint
```

## Components

### User interface

- [Algorithm and settings controls](https://github.com/lucaspilla/sorting-algorithms-visualizer/blob/master/src/display.py): `src/display.py`
- [Input widgets](https://github.com/lucaspilla/sorting-algorithms-visualizer/blob/master/src/display.py): `src/display.py`
- [Window rendering](https://github.com/lucaspilla/sorting-algorithms-visualizer/blob/master/src/display.py): `src/display.py`

### Visualization runtime

- [Visualizer entry point](https://github.com/lucaspilla/sorting-algorithms-visualizer/blob/master/src/main.py): `src/main.py`
- [Algorithm registry](https://github.com/lucaspilla/sorting-algorithms-visualizer/blob/master/src/algs.py): `src/algs.py`
- [Animation steps](https://github.com/lucaspilla/sorting-algorithms-visualizer/blob/master/src/main.py): `src/main.py`

### Sorting algorithms

- [General sorting algorithms](https://github.com/lucaspilla/sorting-algorithms-visualizer/tree/master/src/algorithms): `src/algorithms`
- [Divide-and-merge sorts](https://github.com/lucaspilla/sorting-algorithms-visualizer/blob/master/src/algorithms/mergeSort.py): `src/algorithms/mergeSort.py`
- [Heap sort](https://github.com/lucaspilla/sorting-algorithms-visualizer/blob/master/src/algorithms/heapSort.py): `src/algorithms/heapSort.py`
- [Radix sort](https://github.com/lucaspilla/sorting-algorithms-visualizer/blob/master/src/algorithms/radixSort.py): `src/algorithms/radixSort.py`
- [Shell sort](https://github.com/lucaspilla/sorting-algorithms-visualizer/blob/master/src/algorithms/shellSort.py): `src/algorithms/shellSort.py`
- [Strand sort](https://github.com/lucaspilla/sorting-algorithms-visualizer/blob/master/src/algorithms/strandSort.py): `src/algorithms/strandSort.py`
- [Tree sort](https://github.com/lucaspilla/sorting-algorithms-visualizer/blob/master/src/algorithms/treeSort.py): `src/algorithms/treeSort.py`
- [Timsort](https://github.com/lucaspilla/sorting-algorithms-visualizer/blob/master/src/algorithms/timSort.py): `src/algorithms/timSort.py`
- [Binary insertion helper](https://github.com/lucaspilla/sorting-algorithms-visualizer/blob/master/src/algorithms/binaryInsertionSort.py): `src/algorithms/binaryInsertionSort.py`

### Other components

- **User**

## Connections

- User → Algorithm and settings controls: sets options (evidence: `README.md`)
- Algorithm and settings controls → Input widgets: uses controls (evidence: `src/display.py`)
- User → Visualizer entry point: starts app (evidence: `README.md`)
- Visualizer entry point → Window rendering: uses display (evidence: `src/main.py`)
- Visualizer entry point → Algorithm registry: imports registry (evidence: `src/main.py`)
- Visualizer entry point → Animation steps: drives animation (evidence: `README.md`)
- Algorithm registry → General sorting algorithms: dispatches sorts (evidence: `src/algs.py`)
- Algorithm registry → Divide-and-merge sorts: dispatches sorts (evidence: `src/algs.py`)
- Algorithm registry → Heap sort: dispatches sort (evidence: `src/algs.py`)
- Algorithm registry → Radix sort: dispatches sort (evidence: `src/algs.py`)
- Algorithm registry → Shell sort: dispatches sort (evidence: `src/algs.py`)
- Algorithm registry → Strand sort: dispatches sort (evidence: `src/algs.py`)
- Algorithm registry → Tree sort: dispatches sort (evidence: `src/algs.py`)
- Algorithm registry → Timsort: dispatches sort (evidence: `src/algs.py`)
- Timsort → Binary insertion helper: calls search (evidence: `src/algorithms/timSort.py`)
