Add BFS implementation