Trivial optimization in graph BFS/DFS.