Understanding the Greedy Best-First Search (GBFS) Algorithm in Python