Which of the following is/are valid vertex orderings that can be obtained from a
topological sort of the DAG?
["B","D"]
Step-by-Step Solution
Insight: A topological sort is valid if and only if for every directed edge , vertex appears before vertex in the linear ordering.
Exam route: Extract all directed edges from the graph diagram. Check each given option to see if it violates any of these precedence constraints. Eliminate options with violations.
Learning route:
Step 1: Identify the vertices and directed edges from the SVG diagram.
The edges are: , , , , , and .
Step 2: List the precedence constraints derived from these edges:
- must appear before .
- must appear before .
- must appear before and .
- must appear before .
- must appear before .
Step 3: Evaluate each option against these constraints.
- Option A ("P Q R S T U V"): appears before . This violates the constraint . Invalid.
- Option B ("P R Q V S U T"): are before ; is before and ; is before ; is before . All constraints are satisfied. Valid.
- Option C ("P Q R S V U T"): appears before . This violates the constraint . Invalid.
- Option D ("P R Q S V T U"): are before ; is before and ; is before ; is before . All constraints are satisfied. Valid.
Step 4: Conclude that options B and D are the valid topological orderings.