Question: Topological Sorting of a DAG Using Graph's DFS In this programming assignment, you will implement the topological sorting of a directed acyclic graph ( DAG

Topological Sorting of a DAG Using Graph's DFS
In this programming assignment, you will implement the topological sorting of a directed acyclic graph (DAG) using the graph's depth first search (DFS). Please refer to the lecture slides and book chapter for the algorithm that solves this problem.
Specification
The Java class that has the main function needs to be named as "TopoSort". That is, the name of the source file that contains the main function should be "TopoSort.java".
The input of your program is a text file that represents a given DAG in its list representation. For example, suppose the following is the DAG, for which you need to do the topological sorting:
1
then, the given file, whose name shall be supplied by the grader as a command line parameter, may contain the following content:
0:1,2,3
1:3
2:
3:2
In particular, the input file has multiple lines, where each line has two parts separated by a colon: the first part represents a graph vertex; the second part is the collection of the vertex's next hop neighbors separated by commas.
You are guaranteed that all the vertices in the graph are named as 0,1,dots,n-1, where n is the number of vertices in the graph. However, remind that a given graph can also be represented by other different input text files. For example, the same example graph above can also be represented by the following two text files.
\table[[1:3,1:3
 Topological Sorting of a DAG Using Graph's DFS In this programming

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!