# djsahagun15/pathfinder architecture

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

- Interactive diagram: https://gitdiagram.com/djsahagun15/pathfinder
- Repository: https://github.com/djsahagun15/pathfinder

## Overview

PathFinder is an interactive grid-based pathfinding visualizer. Users edit start/end positions, walls and terrain, choose an algorithm and movement options, then run or pause a search and inspect its explored nodes and resulting path. The principal runtime loop is owned by PathFinder, which coordinates the grid, control panel and selected algorithm. The README also documents camera pan/zoom and reset/clear controls. Algorithm implementations are listed from the repository tree; their internal search details were not sampled.

Main entry points: [`src/pathfinder.cpp`](https://github.com/djsahagun15/pathfinder/blob/master/src/pathfinder.cpp) (PathFinder runtime), [`src/pathfinding_algorithm.cpp`](https://github.com/djsahagun15/pathfinder/blob/master/src/pathfinding_algorithm.cpp) (Algorithm base), [`src/grid.cpp`](https://github.com/djsahagun15/pathfinder/blob/master/src/grid.cpp) (Editable grid), [`src/control_panel.cpp`](https://github.com/djsahagun15/pathfinder/blob/master/src/control_panel.cpp) (Control panel)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application control"]
  node_main["Application entry<br/>[main.cpp]"]
  node_pathfinder["PathFinder runtime<br/>[pathfinder.cpp]"]
end

subgraph group_grid["Grid and display"]
  node_grid["Editable grid<br/>[grid.cpp]"]
  node_node["Cell state and costs<br/>[node.cpp]"]
  node_camera["Camera controls<br/>[camera.cpp]"]
end

subgraph group_search["Pathfinding"]
  node_base["Algorithm base"]
  node_bfs["BFS<br/>[bfs.cpp]"]
  node_dijkstra["Dijkstra<br/>[dijkstra.cpp]"]
  node_astar["A*<br/>[astar.cpp]"]
  node_gbs["Greedy best-first<br/>[gbs.cpp]"]
  node_bidirectional["Bidirectional BFS"]
end

subgraph group_ui["User controls"]
  node_panel["Control panel<br/>[control_panel.cpp]"]
end

node_user(("User"))

node_user -->|"starts app"| node_main
node_main -->|"creates and runs"| node_pathfinder
node_user -->|"sets options"| node_panel
node_user -->|"edits cells"| node_grid
node_user -->|"pans and zooms"| node_camera
node_panel -->|"commands solver"| node_pathfinder
node_pathfinder -->|"draws controls"| node_panel
node_pathfinder -->|"updates and draws"| node_grid
node_grid -->|"stores and draws"| node_node
node_pathfinder -->|"updates view"| node_camera
node_pathfinder -->|"selects and dispatches"| node_bfs
node_pathfinder -->|"selects and dispatches"| node_dijkstra
node_pathfinder -->|"selects and dispatches"| node_astar
node_pathfinder -->|"selects and dispatches"| node_gbs
node_pathfinder -->|"selects and dispatches"| node_bidirectional
node_bfs -->|"uses shared search"| node_base
node_dijkstra -->|"uses shared search"| node_base
node_astar -->|"uses shared search"| node_base
node_gbs -->|"uses shared search"| node_base
node_bidirectional -->|"uses shared search"| node_base
node_base -->|"gets neighbors"| node_grid

click node_main "https://github.com/djsahagun15/pathfinder/blob/master/src/main.cpp"
click node_pathfinder "https://github.com/djsahagun15/pathfinder/blob/master/src/pathfinder.cpp"
click node_grid "https://github.com/djsahagun15/pathfinder/blob/master/src/grid.cpp"
click node_node "https://github.com/djsahagun15/pathfinder/blob/master/src/node.cpp"
click node_camera "https://github.com/djsahagun15/pathfinder/blob/master/src/camera.cpp"
click node_panel "https://github.com/djsahagun15/pathfinder/blob/master/src/control_panel.cpp"
click node_base "https://github.com/djsahagun15/pathfinder/blob/master/src/pathfinding_algorithm.cpp"
click node_bfs "https://github.com/djsahagun15/pathfinder/blob/master/src/bfs.cpp"
click node_dijkstra "https://github.com/djsahagun15/pathfinder/blob/master/src/dijkstra.cpp"
click node_astar "https://github.com/djsahagun15/pathfinder/blob/master/src/astar.cpp"
click node_gbs "https://github.com/djsahagun15/pathfinder/blob/master/src/gbs.cpp"
click node_bidirectional "https://github.com/djsahagun15/pathfinder/blob/master/src/bidirectional_bfs.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_main,node_pathfinder,node_user toneBlue
class node_grid,node_node,node_camera toneAmber
class node_base,node_bfs,node_dijkstra,node_astar,node_gbs,node_bidirectional toneMint
class node_panel toneRose
```

## Components

### Application control

- [Application entry](https://github.com/djsahagun15/pathfinder/blob/master/src/main.cpp): `src/main.cpp`
- [PathFinder runtime](https://github.com/djsahagun15/pathfinder/blob/master/src/pathfinder.cpp): `src/pathfinder.cpp`

### Grid and display

- [Editable grid](https://github.com/djsahagun15/pathfinder/blob/master/src/grid.cpp): `src/grid.cpp`
- [Cell state and costs](https://github.com/djsahagun15/pathfinder/blob/master/src/node.cpp): `src/node.cpp`
- [Camera controls](https://github.com/djsahagun15/pathfinder/blob/master/src/camera.cpp): `src/camera.cpp`

### Pathfinding

- [Algorithm base](https://github.com/djsahagun15/pathfinder/blob/master/src/pathfinding_algorithm.cpp): `src/pathfinding_algorithm.cpp`
- [BFS](https://github.com/djsahagun15/pathfinder/blob/master/src/bfs.cpp): `src/bfs.cpp`
- [Dijkstra](https://github.com/djsahagun15/pathfinder/blob/master/src/dijkstra.cpp): `src/dijkstra.cpp`
- [A*](https://github.com/djsahagun15/pathfinder/blob/master/src/astar.cpp): `src/astar.cpp`
- [Greedy best-first](https://github.com/djsahagun15/pathfinder/blob/master/src/gbs.cpp): `src/gbs.cpp`
- [Bidirectional BFS](https://github.com/djsahagun15/pathfinder/blob/master/src/bidirectional_bfs.cpp): `src/bidirectional_bfs.cpp`

### User controls

- [Control panel](https://github.com/djsahagun15/pathfinder/blob/master/src/control_panel.cpp): `src/control_panel.cpp`

### Other components

- **User**

## Connections

- User → Application entry: starts app
- Application entry → PathFinder runtime: creates and runs
- User → Control panel: sets options
- User → Editable grid: edits cells
- User → Camera controls: pans and zooms
- Control panel → PathFinder runtime: commands solver
- PathFinder runtime → Control panel: draws controls
- PathFinder runtime → Editable grid: updates and draws
- Editable grid → Cell state and costs: stores and draws
- PathFinder runtime → Camera controls: updates view
- PathFinder runtime → BFS: selects and dispatches
- PathFinder runtime → Dijkstra: selects and dispatches
- PathFinder runtime → A*: selects and dispatches
- PathFinder runtime → Greedy best-first: selects and dispatches
- PathFinder runtime → Bidirectional BFS: selects and dispatches
- BFS → Algorithm base: uses shared search
- Dijkstra → Algorithm base: uses shared search
- A* → Algorithm base: uses shared search
- Greedy best-first → Algorithm base: uses shared search
- Bidirectional BFS → Algorithm base: uses shared search
- Algorithm base → Editable grid: gets neighbors
