Selected Algorithm
Breadth-First Search
native
Unweighted graph search
Breadth-first search explores the maze in distance layers, so the first time it reaches the goal is the shortest unweighted route.
enqueue start pop by FIFO layer record parent trace goal path
Recursive Backtracker
Depth-first spanning-tree construction over odd grid cells.
Spanning tree
Perfect maze
O(V + E)
push start choose unvisited neighbor carve wall backtrack on dead ends
Mathematical Breakdown
Layered graph expansion over a grid graph G = (V, E).
Grid graph
Unit cost
enqueue start pop by FIFO layer record parent for every new cell trace parents from goal