Explores the grid level by level using a queue, guaranteeing the shortest path in unweighted graphs.
queue ← [start]parent[start] ← nullwhile queue not empty:v ← pop_front(queue)for each neighbor u of v:if u not seen:parent[u] ← vpush_back(queue, u)if goal reached: reconstruct path