Greedy Best-First Search: A Complete Solved Numerical Example
Scenario: Pipeline Robot Routing
The Objective: Find the fastest route to the destination (G) by making navigation decisions based exclusively on the estimated remaining distance, completely ignoring the actual travel costs.
Core Mechanics▼
- Only the Finish Line : Greedy Search evaluates nodes purely by their estimated distance to the goal . It completely ignores the actual cost traveled so far.
- Always Chase the Lowest: At every step, pop the node from the priority queue with the smallest heuristic. The node that looks closest to the goal is always expanded first.
- Static Scores (No Updates): If you discover a new route to a node already in your Open List, simply ignore it. A node's heuristic never changes, so you never update its score.
- Fast but Foolable (Not Optimal): Because of its severe tunnel vision, a misleading heuristic can trick Greedy into taking a massive detour. It finds the goal quickly, but rarely finds the absolute shortest path.
Step 1: Initial Map Configuration
Find the fastest route to the destination (G) by making navigation decisions based exclusively on the estimated remaining distance, completely ignoring the actual travel costs.
Step 2: Step-by-Step Resolution Trace
Watch the algorithm evaluate scores based solely on the heuristic, aggressively pruning paths even if they might have a lower true cost.
Evaluating Node: S
Open List
[ S(10) ]
Closed List
[ ]
Evaluating Neighbors
Evaluating Node: SC
Open List
[ SC(6), SA(7) ]
Closed List
[ S(10) ]
Evaluating Neighbors
Evaluating Node: SCD
Open List
[ SCD(4), SA(7) ]
Closed List
[ S(10), SC(6) ]
Evaluating Neighbors
Evaluating Node: SCDG
Open List
[ SCDG(0), SA(7) ]
Closed List
[ S(10), SC(6), SCD(4) ]
Evaluating Neighbors
Goal Reached: SCDG
Goal FoundOpen List
[ SA(7) ]
Closed List
[ S(10), SC(6), SCD(4), SCDG(0) ]
Step 3: Final Computed Path
Final Path Reached
(Note: Greedy Search does not guarantee this is the optimal shortest path, only that it is the path the algorithm found based purely on heuristics.)
Final Takeaway
Notice how the algorithm completely ignores the true edge weights and only looks at the heuristic (h) values inside the nodes. At Step 1, it chooses C(6) over A(7) simply because 6 is smaller, happily tunneling down S→C→D→G and finding the optimal path by pure luck!