# sksm-goyal/pathfinding-visualizer architecture

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

- Interactive diagram: https://gitdiagram.com/sksm-goyal/pathfinding-visualizer
- Repository: https://github.com/sksm-goyal/pathfinding-visualizer

## Overview

Pathfinding Visualizer is an interactive C++/SFML application for editing a grid and watching Dijkstra or A* search explore it and display a route. Its runtime is concentrated in src/main.cpp: the event loop handles user input, the search implementations update their respective exploration and path state, and the drawing loop renders that state. The excerpt shows each algorithm calling its path-reconstruction function and rendering from the path arrays. Some event-loop lines are omitted, so algorithm-button dispatch is not asserted.

Main entry points: [`src/main.cpp`](https://github.com/sksm-goyal/pathfinding-visualizer/blob/main/src/main.cpp) (Input and grid editing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["Grid interaction"]
  node_input["Input and grid editing<br/>[main.cpp]"]
  node_grid["Grid state<br/>[main.cpp]"]
end

subgraph group_search["Pathfinding"]
  node_dijkstra["Dijkstra search<br/>[main.cpp]"]
  node_dijkstra_path["Dijkstra path reconstruction<br/>[main.cpp]"]
  node_astar["A* search<br/>[main.cpp]"]
  node_astar_path["A* path reconstruction<br/>[main.cpp]"]
end

subgraph group_display["Visualization"]
  node_renderer["Grid and path renderer<br/>[main.cpp]"]
  node_window["SFML window"]
end

node_user(("User"))

node_user -->|"edits grid"| node_input
node_input -->|"updates cells"| node_grid
node_dijkstra -->|"calls"| node_dijkstra_path
node_astar -->|"calls"| node_astar_path
node_grid -->|"draws cells"| node_renderer
node_renderer -->|"draws frame"| node_window

click node_input "https://github.com/sksm-goyal/pathfinding-visualizer/blob/main/src/main.cpp"
click node_grid "https://github.com/sksm-goyal/pathfinding-visualizer/blob/main/src/main.cpp"
click node_dijkstra "https://github.com/sksm-goyal/pathfinding-visualizer/blob/main/src/main.cpp"
click node_dijkstra_path "https://github.com/sksm-goyal/pathfinding-visualizer/blob/main/src/main.cpp"
click node_astar "https://github.com/sksm-goyal/pathfinding-visualizer/blob/main/src/main.cpp"
click node_astar_path "https://github.com/sksm-goyal/pathfinding-visualizer/blob/main/src/main.cpp"
click node_renderer "https://github.com/sksm-goyal/pathfinding-visualizer/blob/main/src/main.cpp"

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_input,node_grid,node_user toneBlue
class node_dijkstra,node_dijkstra_path,node_astar,node_astar_path toneAmber
class node_renderer,node_window toneMint
```

## Components

### Grid interaction

- [Input and grid editing](https://github.com/sksm-goyal/pathfinding-visualizer/blob/main/src/main.cpp): `src/main.cpp`
- [Grid state](https://github.com/sksm-goyal/pathfinding-visualizer/blob/main/src/main.cpp): `src/main.cpp`

### Pathfinding

- [Dijkstra search](https://github.com/sksm-goyal/pathfinding-visualizer/blob/main/src/main.cpp): `src/main.cpp`
- [Dijkstra path reconstruction](https://github.com/sksm-goyal/pathfinding-visualizer/blob/main/src/main.cpp): `src/main.cpp`
- [A* search](https://github.com/sksm-goyal/pathfinding-visualizer/blob/main/src/main.cpp): `src/main.cpp`
- [A* path reconstruction](https://github.com/sksm-goyal/pathfinding-visualizer/blob/main/src/main.cpp): `src/main.cpp`

### Visualization

- [Grid and path renderer](https://github.com/sksm-goyal/pathfinding-visualizer/blob/main/src/main.cpp): `src/main.cpp`
- **SFML window**

### Other components

- **User**

## Connections

- User → Input and grid editing: edits grid (evidence: `src/main.cpp`)
- Input and grid editing → Grid state: updates cells (evidence: `src/main.cpp`)
- Dijkstra search → Dijkstra path reconstruction: calls (evidence: `src/main.cpp`)
- A* search → A* path reconstruction: calls (evidence: `src/main.cpp`)
- Grid state → Grid and path renderer: draws cells (evidence: `src/main.cpp`)
- Grid and path renderer → SFML window: draws frame (evidence: `src/main.cpp`)
