BFS for the graph added