Skip to content
GATEiit

GATE CSE 2021 Set 2 Q56: Properties of a directed 4×4 grid graph from vertex S

Question

Consider the following directed graph:

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

A 4 by 4 grid of vertices with directed horizontal and vertical edges; vertex S is at the bottom-left corner. Several edges point in opposite directions, forming directed cycles such as around the top-middle square
Tap the figure to enlarge

Try it: multiple select: one or more correct options

Select one or more options
Select all correct options. No negative marking, no partial marks.
Show answer and explanation

Answer: A, B (official GATE 2021 final answer key)

Concept used: A directed graph has a topological order iff it is acyclic; DFS finds one back edge per cycle it closes.

First step: Look for a directed cycle in the grid (for example around one of the top squares), then run DFS from S and mark the edges that point to an ancestor.

Full step-by-step solution

Detailed working, common mistakes and linked mock tests will be available with a free GATEiit account. Log-in is coming soon.

Share this question

WhatsAppDownload image

Source: official GATE 2021 Set 2 CS question paper and final answer key, organised by IIT Bombay. Question paper · Answer key