Welcome to the Pathfinding Algorithm Visualizer. This project allows you to visually explore how algorithms like BFS, GBFS, and A* calculate paths in a grid-based environment. By customizing grid layouts and observing step-by-step computations, you’ll gain a deeper understanding of these algorithms.
The visualizer uses SFML to create an interactive grid-based interface where you can explore how pathfinding algorithms work. Here's what you can do:
- Set Start Point: Press
Sand left-click on a grid cell to set the start point. - Set End Point: Press
Fand left-click on a grid cell to set the end point. - Add Obstacles: Right-click on a grid cell to add an obstacle.
- Clear Obstacles: Right-click again on an obstacle to remove it.
- Clear the Board: Press
Cto reset the entire grid.
You can choose from three pathfinding algorithms:
- BFS: Breadth-First Search systematically explores all nodes at the same depth before proceeding deeper.
- GBFS: Greedy Best-First Search prioritizes nodes closer to the target using a heuristic function.
- A*: A-Star Algorithm uses both actual cost and heuristic cost for efficient pathfinding.
- Press
Bto run BFS. - Press
Gto run GBFS. - Press
Ato run A*.
Once an algorithm is selected, the visualizer dynamically illustrates how it explores nodes, avoids obstacles, and determines the shortest path between the start and end points.
- SFML 2.5
- Real-Time Visualization: Displays every step the algorithm takes to find a path.
- Interactive Grid: Allows users to draw obstacles, set start/end points, and reset the grid.
- Multiple Algorithm Options: Compare how BFS, GBFS, and A* behave under the same conditions.
- Clone the Repository
git clone https://github.com/Argatmj/algorithm-visualizer.git
- Install SFML
sudo apt-get install libsfml-dev
- Build the Program
make
- Run the Program
./main
Check out the demo:
This project follows the architecture illustrated below:

