Last Updated :
21 Dec, 2018
Consider the following statements regarding directed acyclic graph:
- I. If a directed graph G is cyclic but can be made acyclic by removing one edge, then a depth-first search in G will encounter exactly one back edge.
- II. If a depth-first search on a directed graph G = (V,E) produces exactly one back edge, then it is possible to choose an edge e E such that the graph G′ = (V,E − { e }) is acyclic.
Which of the following option is correct?
(A) Statement I is false.
(B) Only statement II is true.
(C) Both (A) and (B)
(D) None
Answer: (C)
Explanation:
- I. False: you can have multiple back edges, yet it can be possible to remove one edge that destroys all cycles. For example, in graph G = (V,E) = ({a,b,c},{(a,b), (b,c),(b,a),(c,a)}), there are two cycles ([a,b,a] and [a,b,c,a]) and a DFS from a in G returns two back edges ((b,a) and (c,a)), but a single removal of edge (a,b) can disrupt both cycles, making the resulting graph acyclic.
- II. True: Removing the back edge will result in a graph with no back edges, and thus a graph with no cycles (as every graph with at least one cycle has at least one back edge). Notice that a graph can have two cycles but a single back edge, thus removing some edge that disrupts that cycle is insufficient, you have to remove specifically the back edge. For example, in graph G = (V,E) = ({a,b,c}, {(a,b), (b,c), (a,c), (c,a)}), there are two cycles [a,b,c,a] and [a,c,a], but only one back edge (c,a) Removing edge (b,c) disrupts one of the cycles that gave rise to the back edge ([a,b,c,a]), but another cycle remains, [a,c,a].
Since statement I is false and II is true. So, both option (A) and (B) are true, hence option (C) is correct choice.
Quiz of this Question
Share your thoughts in the comments
Please Login to comment...