Practice mode Data Structures

A directed graph has edges A→B, A→C, B→D, C→D and D→E. Which of these is a valid topological order?

Correct answer B. A, C, B, D, E

Explanation

In a topological order every edge must point from an earlier vertex to a later one. A, C, B, D, E satisfies all five edges. A, B, D, C, E fails because C must come before D, B, A, ... fails because A must precede B, and A, C, D, B, E puts D before B. A graph can have several valid orders; here A, B, C, D, E also works.

Report a problem

Answer checked How we write and check questions

Tip: press A, B, C or D to answer, and N for the next question.

Advertisement

Have a question about this answer?

Your email address will not be published. Required fields are marked *

Links and website addresses are not allowed in comments.