This interactive platform was developed in 2021 as part of a BSc Computer Science Academic Project. Its primary objective is to visually and interactively demonstrate pathfinding search strategies, graph traversal, and core data structures (such as Queues, Stacks, and Priority Queues) in real-time. By bridging the gap between theory and execution, it provides an intuitive learning aid for computer science students.
At its core, pathfinding is the problem of finding a route between two points. In computer science, this is modeled using Graph Theory:
To find a path, an algorithm must search the graph systematically. It splits nodes into three categories:
Each pathfinding algorithm operates based on how it manages its "frontier" (the list of cells waiting to be explored). The data structure choice changes search behavior:
How it works: Explores the grid layer-by-layer, expanding outwards uniformly like ripples in a pond. It scans every node at distance 1, then distance 2, etc.
Data Structure: Queue (FIFO - First-In, First-Out). Newly discovered cells are added to the Back, and the next cell to evaluate is pulled from the Front. This FIFO order ensures breadth-first expansion.
Shortest Path Guarantee: Yes (on unweighted grids).
How it works: Plunges deep along a single path, following it until it hits a wall or dead end, and only then backtracks to try other paths.
Data Structure: Stack (LIFO - Last-In, First-Out). Newly discovered cells are pushed onto the Top, and the next cell is popped from the Top. LIFO forces the search to continue along the newest path.
Shortest Path Guarantee: No. It returns the first path it finds, which is usually suboptimal.
How it works: Uses a cost formula f(n) = g(n) + h(n) to find the target. g(n) is the distance traveled from start, and h(n) is the estimated distance to the target.
Data Structure: Priority Queue. Nodes are sorted so the one with the lowest total cost f(n) is popped first. This "steers" the search directly towards the target.
Shortest Path Guarantee: Yes (if heuristic is admissible).
How it works: Rushes straight towards the target by prioritizing the cell that appears geometrically closest, ignoring the distance traveled so far.
Data Structure: Priority Queue (Sorted by Heuristic h(n) Only). Popping the lowest h(n) node makes the search very fast, but blind to obstacles.
Shortest Path Guarantee: No. Can be misled by walls and dead ends.
How it works: Runs two concurrent Breadth-First Searches—one starting at the start node moving forward, and one starting at the target node moving backward. The search stops when they meet.
Data Structure: Double Queue (Two FIFO Queues). Alternating expansions between the two queues minimizes the search tree size.
Shortest Path Guarantee: Yes.
A* Search uses distance estimations to guide its path:
This web application runs the pathfinding simulation in two phases:
visited_list and the final route into a path_list.window.setInterval) reads from the lists step-by-step, updating cell colors to blue/green and feeding the Live Execution Monitor with frontier updates.Backtracking Path Reconstruction: Every node remembers its "parent" (the cell that discovered it). Once the target node is reached, the visualizer steps backwards through parent nodes until it reaches the start, reversing the sequence to draw the yellow path.
Choose "Custom Sandbox" in the solving dropdown to reveal the editor. Write custom algorithms in JS and call helpers like:
helpers.getNeighbours(cell): returns adjacent coordinates.helpers.getVal(x, y): returns grid cell values (0: path, -1: wall, -2: bounds).helpers.distance(p1, p2): returns straight-line distance.