implementing antf_bfs