Skip to content
Albert101255Public

About

Live Demo: https://albert101255.github.io/PathForge/ | Interactive C++17 & SFML pathfinding visualizer for A*, Dijkstra, BFS, and DFS with decoupled algorithms and unit tests

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

12 Commits

Folders and files

Repository files navigation

PathForge — Real-Time Pathfinding Visualizer

Live Interactive Web Visualizer: https://albert101255.github.io/PathForge/

PathForge — Pathfinding Visualizer

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.

Algorithms

  • 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.

What this project demonstrates

  • C++17
  • Graph/grid traversal
  • Queues and priority queues
  • Heuristics
  • Object-oriented design
  • SFML rendering/input
  • CMake builds
  • Separation between algorithm logic and visualization

Controls

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 + / -

Architecture

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.

Complexity notes

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

Build

Linux

sudo apt update
sudo apt install build-essential cmake libsfml-dev

Windows / MSYS2

pacman -S mingw-w64-ucrt-x86_64-sfml

Compile & Test

cmake -S . -B build
cmake --build build
ctest --test-dir build --output-on-failure

Project status

Includes 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.

License

MIT License — see LICENSE.

Author

Albert

About

Live Demo: https://albert101255.github.io/PathForge/ | Interactive C++17 & SFML pathfinding visualizer for A*, Dijkstra, BFS, and DFS with decoupled algorithms and unit tests

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages