Greedy Best-First Search
Always expands the node that looks closest to the goal, ignoring the cost so far.
The idea
It orders the open list only by the heuristic h(n), the estimated distance to the goal. That makes it fast and goal-directed on open maps, but it can be led into dead ends and does not guarantee the shortest path.
priority = h(n)
Watch it run
This is a real computation, not a drawing. Pause, step, change the settings, or try new random data.
- current
- frontier
- explored
- path
Walls are dark, brown cells are mud (cost 3), everything else costs 1. Find a route from S to G.
Compare modes on the same map: A* and UCS find the cheapest route, greedy is fast but can be fooled.
Step by step
- 1Put the start node on the open list.
- 2Take the node with the smallest h(n).
- 3If it is the goal, stop.
- 4Otherwise add its unseen neighbours to the open list and repeat.
Where it is used
Quick approximate routing where optimality does not matter.
Watch out for
Not optimal and not complete on graphs with traps. It can be fooled by walls that sit between you and the goal.