I guess that would also simplify the code, because you wouldn't need to keep track of the already contacted nodes.