First-time and second-time seen edges in DFS on undirected graphs
Here is the simplest example.
Let the graph contain two vertices, $x$ and $y$ with one edge $\{x,y\}$. Here is a run of the algorithm.

$x$ and $y$ are marked as &quot;undiscovered&quot;.
$y$ is marked as &quot;discovered&quot; and enqueued.
$y$ is dequeued.

Since $x$ is adjacent to $y$ and $x$ is &quot;undiscovered&quot;, $x$ is marked as &quot;discovered&quot; and enqueued.
All vertices adjacent to $y$ have been &quot;discovered&quot;, so $y$ is marked as
&quot;processed&quot;.


$x$ is dequeued.

$y$ is adjacent to $x$ but $y$ is not &quot;undiscovered&quot;, do nothing.
All vertices adjacent to $x$ have been &quot;discovered&quot;, so $x$ is marked as &quot;processed&quot;.


The queue is empty. Done.

You can note that, at step 4.1 when $y$ has been marked as &quot;processed&quot;, we are seeing y again by the same edge $\{x, y\}$.

Here is an exercise that characterizes such occasions.
Exercise. Suppose we are given a BFS or DFS of a connected undirected graph with more than one vertices.  Let $y$ be a vertex. Show the following two propositions are equivalent.

There is a time that $y$ was seen again when $y$ had been marked as &quot;processed&quot;.
$y$ is not a leaf of the search tree.