Answered step by step
Verified Expert Solution
Question
00
1 Approved Answer
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: then, the given file, whose name shall be supplied by the grader as a command line parameter, may contain the following content: : : : : 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 dots, where 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::
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:
then, the given file, whose name shall be supplied by the grader as a command line parameter, may contain the following content:
:
:
:
:
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 dots, where 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::
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started