bfs (passed on toy graphs)