Added BFS grid traversal.