retagged by
12,951 views
30 30 votes

Consider the DAG with $V = \{1,2,3,4,5,6\}$ shown below.

Which of the following is not a topological ordering?

  1. $1$ $2$ $3$ $4$ $5$ $6$
  2. $1$ $3$ $2$ $4$ $5$ $6$
  3. $1$ $3$ $2$ $4$ $6$ $5$
  4. $3$ $2$ $4$ $1$ $6$ $5$

7 Answers

Best answer
42 42 votes

Go with vertex with indegree 0. Remove the vertex with all edges going from it. Repeat the procedure.

We see that $3$ cannot come at first because indegree is not $0$. So, D is the answer here.

ALL other options are in Topological order.

Only $1$ and $4$ order matter for this question.

edited by
8 8 votes

choose vertex in the graph which has 0 indegree. now see graph has vertex 1 with 0 indegree so remove this along with its edges.

after that there are two possibilities remove one by one either vertex 2 or 3. after that there is one possibility remove vertex 4 .after that two possibilities remove either vertex 5 or 6 one by one. the order of vertex we get is called  topological ordering.

here a,b,c are correct but d is wrong. so d is ans

6 6 votes
The arrow represents which comes after or which comes before i.e a-->b means that a must come before b or b must come after a

Now jump to the given diagram, as it is clear that

i) 2 and 3 must come after 1

ii) 4 must come after 2 and 3 so obvious comes after 1 also

iii) 5 and 6 must come after 4 so obvious must comes after 1,2 and 3 also.

Now follow this step and check with the given options

Hence option D is not correct as 3 does not comes before 1 (point no. i)

NOTE: (2,3) and (5,6) are at same level, therefore their positions can be interchange as in option (A and B) position of 2 and 3 interchanged.
5 5 votes
One of Good definition of Topological sorting is that  if in the the Graph $G$ there are two vertices $u,$  $v$  and  there is an edge between    $u\underset{}{\rightarrow}v$  so in topological ordering $u$ must appear before $v$ .

Now see all Options satisfying the condition except the D option in which  3 is coming before 1 so its not a valid ordering .
4 4 votes
choose vertex in the graph which has 0 indegree. now see graph has vertex 1 with 0 indegree so remove this along with its edges.    See option D) it is starting with vertex 3 which is not having indegree as zero so it can not be answer ..

Therefore option D)
1 1 vote

Answer : Option (D)

Option D is not a valid topological sorting order as it violates the directed acyclic graph (DAG) structure, as depicted in the accompanying image.

Answer:
Position:
Show:

Related questions

50 50 votes
5 answers 5 answers
26.4k
26.4k views
Kathleen asked Sep 21, 2014
26,446 views
In an unweighted, undirected connected graph, the shortest path from a node $S$ to every other node is computed most efficiently, in terms of time complexity, byDijkstra’...
42 42 votes
5 answers 5 answers
11.9k
11.9k views
go_editor asked Sep 26, 2014
11,912 views
Consider the directed graph below given. Which one of the following is TRUE?The graph does not have any topological ordering.Both PQRS and SRQP are topological orderings....
93 93 votes
11 answers 11 answers
44.7k
44.7k views
Kathleen asked Sep 21, 2014
44,691 views
An array of $n$ numbers is given, where $n$ is an even number. The maximum as well as the minimum of these $n$ numbers needs to be determined. Which of the following is T...
33 33 votes
4 answers 4 answers
16.2k
16.2k views
Kathleen asked Sep 21, 2014
16,161 views
Which of the following sorting algorithms has the lowest worse-case complexity?Merge sortBubble sortQuick sortSelection sort