enter image description here
I
I am studying Depth First Search (DFS) on undirected graphs and I am confused about discovery order.
I have attached a figure of an undirected graph with DFS discovery (d) and finishing (f) times marked on each vertex.
In my traversal, vertex d directly discovers vertex e (there is an edge between them, and e is still unvisited when DFS is at d).
However, I have seen explanations suggesting that DFS must backtrack to an ancestor (like a) before discovering e, even though d is connected to e.
My questions are:
Is my DFS traversal and timing valid?
Can
ddirectly discoverein DFS, or does this depend on adjacency list order?Is there any DFS rule that forbids discovering
efromdif an edge exists?
I want to be sure I am applying DFS rules correctly.