Let \(G\) be a directed graph and \(T\) a depth first search (DFS) spanning tree in \(G\) that is rooted at a vertex \(v\). Suppose \(T\) is also a breadth first search (BFS) tree in \(G\), rooted at \(v\). Which of the following statements is/are TRUE for every such graph \(G\) and tree \(T\) ?
GATE CS - 2024,
Answer: C
The statement that always holds is There are no forward-edges in \(G\) with respect to the tree \(T\).
A forward edge goes from a vertex u to a descendant w of u that is not its child, so w is at least two levels below u in T. In a BFS tree, every edge (u, w) satisfies depth(w) \(\le\) depth(u) + 1, because BFS reaches w no later than one step after u. Since T is a BFS tree, such an edge is impossible.
The other statements can fail. A back edge, such as an edge from a child back to v, is allowed. A cross edge is possible too: with edges v\(\to\)a, v\(\to\)b and b\(\to\)a, the tree {v\(\to\)a, v\(\to\)b} is both a DFS and a BFS tree, and b\(\to\)a is a cross edge. Those examples also show G can have edges outside T.
Please log in or register to report this question.