Same maze, same goal: BFS spreads evenly in every direction like ripples before it touches the target, while A* leans hard to one side, examining far fewer cells for a path just as short. The whole difference sits inside f = g + h, where h estimates the remaining distance by the Manhattan metric. DFS charges down one branch before it deigns to backtrack, so its visited trail snakes about and the route it hands back is often absurdly long. Once the grid is dotted with mud cells that cost five times as much, Dijkstra orders its queue by total cost and prefers a cheap detour to an expensive straight line.
Same maze, same goal: BFS spreads evenly in every direction like ripples before it touches the target, while A* leans hard to one side, examining far fewer cells for a path just as short. The whole difference sits inside f = g + h, where h estimates the remaining distance by the Manhattan metric. DFS charges down one branch before it deigns to backtrack, so its visited trail snakes about and the route it hands back is often absurdly long. Once the grid is dotted with mud cells that cost five times as much, Dijkstra orders its queue by total cost and prefers a cheap detour to an expensive straight line.
Related topics in Mind & Machine