Open In App
Related Articles

GATE | GATE CS 2018 | Question 62

Improve Article
Save Article
Like Article

Let G be a simple undirected graph. Let TD be a depth first search tree of G. Let TB be a breadth first search tree of G. Consider the following statements. (I) No edge of G is a cross edge with respect to TD. (A cross edge in G is between two nodes neither of which is an ancestor of the other in TD). (II) For every edge (u, v) of G, if u is at depth i and v is at depth j in TB, then ∣i − j∣ = 1. Which of the statements above must necessarily be true?


I only


II only


Both I and II


Neither I nor II

Answer: (A)


There are four types of edges can yield in DFS. These are tree, forward, back, and cross edges. In undirected connected graph, forward and back edges are the same thing. A cross edge in a graph is an edge that goes from a vertex v to another vertex u such that u is neither an ancestor nor descendant of v. Therefore, cross edge is not possible in undirected graph. So, statement (I) is correct. For statement (II) take counterexample of complete graph of three vertices, i.e., K3 with XYZ, where X is source and Y and Z are in same level. Also,there is an edge between vertices Y and Z, i.e., |i-j| = 0 ≠ 1 in BFS. So, statement became false. Option (A) is correct.

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

Last Updated : 09 Mar, 2018
Like Article
Save Article
Similar Reads