10. 4. BFS
● Explores all
neighboring
vertices before
going in depth
(1) (2)
Source: DDW notes
11. 4. BFS
● Problem: Find shortest path from S to H
● Algorithm:
1. Dequeue SearchNode X from queue
2. For every nth neighbor of X:
a. Create SearchNode N
i. state=neighbor, action=n, parent=X
b. If N is goal → return path
c. Else if N is already explored → pass
d. Else → queue N
● Implementation using SM: StateSpaceSearch
○ State: Node
○ Input: Neighbor #
○ Output: Next node
Source: DDW notes