1BFS counts steps, Dijkstra counts cost
Breadth-first search explores in rings of equal step count, using a plain queue. On a board where every move costs the same that is already the shortest route, and it is the fastest exact method there. Add mud (3 per step) or water (6) and BFS still takes the fewest steps, straight through the swamp.
The mazes come from five carving algorithms; the space station is grown instead, tile by tile, by Wave function collapse, whose own backtracking is the same depth-first search as the recursive backtracker. Its solar trusses are mud and its reactor coolant water, and any finished station or drawing there opens here with race it in pathfinding.
Dijkstra swaps the queue for a priority queue keyed by g, the cost so far, so its rings are of equal cost instead. It pays a log factor for the heap and never gets the cost wrong while costs are not negative.
g(v) = min over arcs u→v of g(u) + c(u, v)Dijkstra settles nodes in order of g; BFS assumes every c = 1here: BFS route … in … steps, Dijkstra … in …
BFS O(V + E) · Dijkstra O((V + E) log V)V nodes, E arcsthis board: V = …, E = …