Unit24 TopologicalSort
Unit24 TopologicalSort
Introduction. Definition of Topological Sort. Topological Sort is Not Unique. Topological Sort Algorithm. An Example.
Implementation.
Review Questions.
Introduction
There are many problems involving a set of tasks in which some of the tasks must be done before others. For example, consider the problem of taking a course only after taking its prerequisites. Is there any systematic way of linearly arranging the courses in the order that they should be taken?
(a)
(b)
2
B
3
C
0
D
2
E
H 2
Review Questions
1. List the order in which the nodes of the directed graph GB are visited by topological order traversal that starts from vertex a. 2. What kind of DAG has a unique topological sort?
3. Generate a directed graph using the required courses for your major. Now apply topological sort on the directed graph you obtained.