Live Interactive Web Visualizer: https://albert101255.github.io/PathForge/
Live Interactive Visualizer: https://albert101255.github.io/PathForge/
An interactive C++17 pathfinding visualizer built with SFML (with a companion interactive web visualizer on GitHub Pages). It lets you draw obstacles, paint weighted terrain, choose a search algorithm, and watch the algorithm explore the grid before reconstructing a path.
- A* — uses a heuristic to guide exploration toward the target
- Dijkstra — computes shortest paths for non-negative edge costs
- Breadth-First Search (BFS) — finds a shortest path in an unweighted grid
- Depth-First Search (DFS) — explores deeply but does not guarantee a shortest path
A* is often faster than uninformed search when the heuristic is informative, but performance depends on the map, heuristic and implementation.
- C++17
- Graph/grid traversal
- Queues and priority queues
- Heuristics
- Object-oriented design
- SFML rendering/input
- CMake builds
- Separation between algorithm logic and visualization
| Action | Input |
|---|---|
| Draw wall | Left-click / drag |
| Erase wall | Right-click |
| Place start | S + left-click |
| Place end | E + left-click |
| Run | Space |
| Reset path | R |
| Clear grid | C |
| Select algorithm | 1 A*, 2 Dijkstra, 3 BFS, 4 DFS |
| Adjust speed | + / - |
Grid / Cell state
|
v
Pathfinding algorithm
|
v
Search-step updates
|
v
SFML renderer / UI
The IPathfinder abstraction keeps the algorithm implementation separate from the visualization layer so different search strategies can be selected without rewriting the UI.
For a graph with V vertices and E edges:
- BFS:
O(V + E) - DFS:
O(V + E) - Dijkstra with a binary heap: approximately
O((V + E) log V) - A*: worst-case behavior depends on the heuristic and graph, while a useful heuristic can significantly reduce explored nodes in practice
sudo apt update
sudo apt install build-essential cmake libsfml-devpacman -S mingw-w64-ucrt-x86_64-sfmlcmake -S . -B build
cmake --build build
ctest --test-dir build --output-on-failureIncludes a headless unit test suite (tests/test_pathfinding.cpp) covering Grid state management, BFS, DFS, Dijkstra, and A* across open grids, obstacles, unreachable targets, start == end edge cases, and weighted terrain.
MIT License — see LICENSE.