in bfs, use "discover" instead of "pre-visit"