Consider the following directed graph: Which of the following is/are correct…

2021

Consider the following directed graph: 

Which of the following is/are correct about the graph?

  1. A.

    The graph does not have a topological order.

  2. B.

    A depth-first traversal starting at vertex S classifies three directed edges as back edges.

  3. C.

    The graph does not have a strongly connected component.

  4. D.

    For each pair of vertices u and v, there is a directed path from u to v

Attempted by 93 students.

Show answer & explanation

Correct answer: A, B

Final conclusion: The only correct statement is that the graph does not have a topological order.

Reason:

  • Presence of directed cycles prevents a topological ordering. A topological order exists only for directed acyclic graphs (DAGs). In this graph, following the directed edges around any small directed square brings you back to the starting vertex, so a directed cycle exists.

  • Depth-first search edge classification depends on the neighbor visitation order. The exact number of back edges cannot be determined from the picture alone without specifying how neighbors are visited; each directed cycle contributes at least one back edge in some DFS orders, but the total count may vary.

  • There are strongly connected components: nodes on the same directed cycle are mutually reachable, so they form nontrivial strongly connected components. Therefore the claim that there are no strongly connected components is false.

  • The graph is not strongly connected as a whole, so it is not true that for every pair of vertices u and v there is a directed path from u to v. Edge directions restrict reachability between some vertices.

Therefore the correct answer is: the graph does not have a topological order, because directed cycles are present.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Gate Guidance By Sanchit Sir