Open In App
Related Articles

Algorithms | Graph Traversals | Question 12

Improve Article
Save Article
Like Article

Is the following statement true/false? A DFS of a directed graph always produces the same number of tree edges, i.e., independent of the order in which vertices are considered for DFS. 





Answer: (B)


The statement is false.

A Depth-First Search (DFS) of a directed graph can produce a different number of tree edges depending on the order in which vertices are considered for the DFS. The number of tree edges in a DFS tree depends on the specific traversal path taken during the DFS.

During a DFS, starting from a particular source vertex, the traversal explores the graph by visiting neighboring vertices in a systematic way. The order in which the neighboring vertices are visited impacts the formation of the DFS tree.

Hence (B) is the correct answer.

Quiz of this Question
Please comment below if you find anything wrong in the above post

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 28 Jun, 2021
Like Article
Save Article
Similar Reads