Add bfs with a new algorithm