# arpitmurailya18/path-pivot architecture

> Architecture diagram of the GitHub repository arpitmurailya18/path-pivot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/arpitmurailya18/path-pivot
- Repository: https://github.com/arpitmurailya18/path-pivot

## Overview

#### Purpose and Runtime
Path & Pivot is a native C++ desktop algorithm visualizer. It uses SFML for its window, rendering, input, timing, and likely text/UI primitives; SFML headers and static/shared libraries are vendored under `External/include/SFML` and `External/lib`. Prebuilt Windows executables exist at `sfml work/main.exe` and `sfml work/PathandPivot.exe`.

#### Application Entry and Mode Routing
The executable entry point is `sfml work/main.cpp`. It likely owns the SFML event/render loop and dispatches between the two primary experiences: sorting visualization and grid/pathfinding visualization. `sfml work/src/Homepage.cpp` and `sfml work/src/Homepage.h` define the landing or mode-selection boundary.

#### Shared Visualization Control Layer
The application is interactive rather than batch-oriented: user events control play/pause, reset, generation, speed, and algorithm selection. Rendering colors/states are centralized in `sfml work/src/VisualizerColor.h`; algorithm-facing explanatory UI is represented by `sfml work/src/Pseudocode.h`. This layer separates visual state and controls from the algorithm implementations.

#### Sorting Pipeline
Sorting operates over a one-dimensional generated array, updating visual frames and collecting run metrics such as comparisons and array accesses. Each sorting strategy is independently implemented behind paired source/header units:
- `sfml work/src/BubbleSort.cpp`, `sfml work/src/BubbleSort.h`
- `sfml work/src/InsertionSort.cpp`, `sfml work/src/InsertionSort.h`
- `sfml work/src/MergeSort.cpp`, `sfml work/src/MergeSort.h`
- `sfml work/src/QuickSort.cpp`, `sfml work/src/QuickSort.h`
- `sfml work/src/SelectionSort.cpp`, `sfml work/src/SelectionSort.h`

The key boundary is algorithm mutation/instrumentation versus the SFML-driven presentation loop, allowing execution progress to be visualized in real time.

#### Grid and Maze Model
Pathfinding runs over a two-dimensional grid model defined by `sfml work/src/Grid.cpp` and `sfml work/src/Grid.h`. The grid is the shared domain object for user-authored walls/weights, start and destination positions, traversal markings, and reconstructed paths. `sfml work/src/MazeGenerator.cpp` and `sfml work/src/MazeGenerator.h` generate maze layouts that feed the same grid model, rather than being a separate pathfinding representation.

#### Pathfinding Pipeline
Pathfinding algorithms consume the grid state, progressively mark search/frontier results, then report outcomes such as nodes visited and path cost. Implementations are isolated by algorithm:
- `sfml work/src/BFS.cpp`, `sfml work/src/BFS.h`
- `sfml work/src/DFS.cpp`, `sfml work/src/DFS.h`
- `sfml work/src/Dijkstra.cpp`, `sfml work/src/Dijkstra.h`
- `sfml work/src/Astar.cpp`, `sfml work/src/Astar.h`

This provides a common visualization surface while preserving algorithm-specific traversal and cost behavior.

#### Dependencies and Delivery Boundary
There is no server, database, or external runtime service indicated. The application is a Windows-oriented local executable built with g++/MinGW, with SFML packaged in-repository. SFML itself brings graphics/windowing and optional audio/network facilities, though the repository’s architecture is centered on local graphical visualization rather than networked functionality.

Main entry points: [`sfml work/src/Grid.cpp`](https://github.com/arpitmurailya18/path-pivot/blob/main/sfml%20work/src/Grid.cpp) (Grid Model), [`sfml work/main.cpp`](https://github.com/arpitmurailya18/path-pivot/blob/main/sfml%20work/main.cpp) (Application Entry), [`sfml work/src/Homepage.cpp`](https://github.com/arpitmurailya18/path-pivot/blob/main/sfml%20work/src/Homepage.cpp) (Mode Selection), [`sfml work/src/VisualizerColor.h`](https://github.com/arpitmurailya18/path-pivot/blob/main/sfml%20work/src/VisualizerColor.h) (Visual States)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Desktop Application"]
  node_entry["Application Entry<br/>C++ entry point<br/>[main.cpp]"]
  node_homepage["Mode Selection<br/>homepage UI<br/>[Homepage.cpp]"]
  node_controls["Visualization Controls<br/>interactive control layer"]
  node_colors["Visual States<br/>color definitions<br/>[VisualizerColor.h]"]
  node_pseudocode["Algorithm Explanations<br/>pseudocode UI<br/>[Pseudocode.h]"]
end

subgraph group_sorting["Sorting Visualization"]
  node_sorting_surface["Array Visualization<br/>sorting state and metrics"]
  node_bubble["Bubble Sort<br/>sorting algorithm<br/>[BubbleSort.cpp]"]
  node_insertion["Insertion Sort<br/>sorting algorithm<br/>[InsertionSort.cpp]"]
  node_merge["Merge Sort<br/>sorting algorithm<br/>[MergeSort.cpp]"]
  node_quick["Quick Sort<br/>sorting algorithm<br/>[QuickSort.cpp]"]
  node_selection["Selection Sort<br/>sorting algorithm<br/>[SelectionSort.cpp]"]
end

subgraph group_pathfinding["Pathfinding Visualization"]
  node_grid["Grid Model<br/>2D domain model<br/>[Grid.cpp]"]
  node_maze["Maze Generator<br/>grid generator<br/>[MazeGenerator.cpp]"]
  node_path_algorithms["Pathfinding Algorithms<br/>BFS, DFS, Dijkstra, A*"]
end

subgraph group_runtime["Native Runtime"]
  node_sfml{{"SFML<br/>vendored graphics runtime"}}
  node_executable["Windows Executable<br/>local desktop binary<br/>[PathandPivot.exe]"]
end

node_entry -->|"starts at"| node_homepage
node_homepage -->|"selects sorting"| node_sorting_surface
node_homepage -->|"selects pathfinding"| node_grid
node_controls -->|"controls"| node_sorting_surface
node_controls -->|"edits and runs"| node_grid
node_colors -->|"colors frames"| node_sorting_surface
node_colors -->|"colors cell states"| node_grid
node_pseudocode -->|"explains selection"| node_controls
node_bubble -->|"mutates and instruments"| node_sorting_surface
node_insertion -->|"mutates and instruments"| node_sorting_surface
node_merge -->|"mutates and instruments"| node_sorting_surface
node_quick -->|"mutates and instruments"| node_sorting_surface
node_selection -->|"mutates and instruments"| node_sorting_surface
node_maze -->|"generates layout"| node_grid
node_path_algorithms -->|"traverses and reconstructs"| node_grid
node_entry -->|"uses event and render runtime"| node_sfml
node_entry -.->|"builds to"| node_executable

click node_entry "https://github.com/arpitmurailya18/path-pivot/blob/main/sfml%20work/main.cpp"
click node_homepage "https://github.com/arpitmurailya18/path-pivot/blob/main/sfml%20work/src/Homepage.cpp"
click node_colors "https://github.com/arpitmurailya18/path-pivot/blob/main/sfml%20work/src/VisualizerColor.h"
click node_pseudocode "https://github.com/arpitmurailya18/path-pivot/blob/main/sfml%20work/src/Pseudocode.h"
click node_bubble "https://github.com/arpitmurailya18/path-pivot/blob/main/sfml%20work/src/BubbleSort.cpp"
click node_insertion "https://github.com/arpitmurailya18/path-pivot/blob/main/sfml%20work/src/InsertionSort.cpp"
click node_merge "https://github.com/arpitmurailya18/path-pivot/blob/main/sfml%20work/src/MergeSort.cpp"
click node_quick "https://github.com/arpitmurailya18/path-pivot/blob/main/sfml%20work/src/QuickSort.cpp"
click node_selection "https://github.com/arpitmurailya18/path-pivot/blob/main/sfml%20work/src/SelectionSort.cpp"
click node_grid "https://github.com/arpitmurailya18/path-pivot/blob/main/sfml%20work/src/Grid.cpp"
click node_maze "https://github.com/arpitmurailya18/path-pivot/blob/main/sfml%20work/src/MazeGenerator.cpp"
click node_sfml "https://github.com/arpitmurailya18/path-pivot/tree/main/External/include/SFML"
click node_executable "https://github.com/arpitmurailya18/path-pivot/blob/main/sfml%20work/PathandPivot.exe"

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_entry,node_homepage,node_controls,node_colors,node_pseudocode toneBlue
class node_sorting_surface,node_bubble,node_insertion,node_merge,node_quick,node_selection toneAmber
class node_grid,node_maze,node_path_algorithms toneMint
class node_sfml,node_executable toneRose
```

## Components

### Desktop Application

- [Application Entry](https://github.com/arpitmurailya18/path-pivot/blob/main/sfml%20work/main.cpp): C++ entry point · Owns the SFML event and render loop. · `sfml work/main.cpp`
- [Mode Selection](https://github.com/arpitmurailya18/path-pivot/blob/main/sfml%20work/src/Homepage.cpp): homepage UI · `sfml work/src/Homepage.cpp`
- **Visualization Controls**: interactive control layer · Handles playback, reset, generation, speed, and algorithm choices.
- [Visual States](https://github.com/arpitmurailya18/path-pivot/blob/main/sfml%20work/src/VisualizerColor.h): color definitions · `sfml work/src/VisualizerColor.h`
- [Algorithm Explanations](https://github.com/arpitmurailya18/path-pivot/blob/main/sfml%20work/src/Pseudocode.h): pseudocode UI · `sfml work/src/Pseudocode.h`

### Sorting Visualization

- **Array Visualization**: sorting state and metrics · Generated array, frame updates, comparisons, and accesses.
- [Bubble Sort](https://github.com/arpitmurailya18/path-pivot/blob/main/sfml%20work/src/BubbleSort.cpp): sorting algorithm · `sfml work/src/BubbleSort.cpp`
- [Insertion Sort](https://github.com/arpitmurailya18/path-pivot/blob/main/sfml%20work/src/InsertionSort.cpp): sorting algorithm · `sfml work/src/InsertionSort.cpp`
- [Merge Sort](https://github.com/arpitmurailya18/path-pivot/blob/main/sfml%20work/src/MergeSort.cpp): sorting algorithm · `sfml work/src/MergeSort.cpp`
- [Quick Sort](https://github.com/arpitmurailya18/path-pivot/blob/main/sfml%20work/src/QuickSort.cpp): sorting algorithm · `sfml work/src/QuickSort.cpp`
- [Selection Sort](https://github.com/arpitmurailya18/path-pivot/blob/main/sfml%20work/src/SelectionSort.cpp): sorting algorithm · `sfml work/src/SelectionSort.cpp`

### Pathfinding Visualization

- [Grid Model](https://github.com/arpitmurailya18/path-pivot/blob/main/sfml%20work/src/Grid.cpp): 2D domain model · Stores walls, weights, endpoints, search markings, and paths. · `sfml work/src/Grid.cpp`
- [Maze Generator](https://github.com/arpitmurailya18/path-pivot/blob/main/sfml%20work/src/MazeGenerator.cpp): grid generator · `sfml work/src/MazeGenerator.cpp`
- **Pathfinding Algorithms**: BFS, DFS, Dijkstra, A* · Progressively traverse and mark the shared grid.

### Native Runtime

- [SFML](https://github.com/arpitmurailya18/path-pivot/tree/main/External/include/SFML): vendored graphics runtime · Provides windowing, rendering, input, and timing. · `External/include/SFML`
- [Windows Executable](https://github.com/arpitmurailya18/path-pivot/blob/main/sfml%20work/PathandPivot.exe): local desktop binary · `sfml work/PathandPivot.exe`

## Connections

- Application Entry → Mode Selection: starts at
- Mode Selection → Array Visualization: selects sorting
- Mode Selection → Grid Model: selects pathfinding
- Visualization Controls → Array Visualization: controls
- Visualization Controls → Grid Model: edits and runs
- Visual States → Array Visualization: colors frames
- Visual States → Grid Model: colors cell states
- Algorithm Explanations → Visualization Controls: explains selection
- Bubble Sort → Array Visualization: mutates and instruments
- Insertion Sort → Array Visualization: mutates and instruments
- Merge Sort → Array Visualization: mutates and instruments
- Quick Sort → Array Visualization: mutates and instruments
- Selection Sort → Array Visualization: mutates and instruments
- Maze Generator → Grid Model: generates layout
- Pathfinding Algorithms → Grid Model: traverses and reconstructs
- Application Entry → SFML: uses event and render runtime
- Application Entry → Windows Executable: builds to
