bfs_function3 (2)