def breadthFirstSearch(problem):
"""
Search the shallowest nodes in the search tree first.
"""
# Use the genericSearch method, with the fringe maintained with a Queue so
# that all nodes on the same level are explored before the next level is
# explored. This will find the optimal solution, because each level is
# explored before the next, so the first time the goal is reached will be
# the shortest path to the goal.
return genericSearch(problem, util.Queue())
评论列表
文章目录