Question: Write a C++ program that implements the topological sorting algorithm based on the DFS algorithm. Your program should read an input file name and determine

Write a C++ program that implements the topological sorting algorithm based on the DFS algorithm. Your program should read an input file name and determine if the input graph is a DAG (= directed acyclic graph) or not. If the graph is not a DAG, your program has to stop without further processing. However, if its a DAG, your program should display the starting node(s), popping-off order, and topologically sorted list. In the problem, you can assume that the number of nodes in the input file is less than 100. Input file format: This is a sample input file called t1.txt. Write a C++ program that implements the topological sorting algorithm based on

nut mc foraat This ed ei. tt 01 1 2 Output: $ g++-o?ts.cpp Enter a filename: C:VVtmp\Itl.txt This is a DAG Start node (s) 0 Popping-off order: 21 0 Topological sort: 0->2 nut mc foraat This ed ei. tt 01 1 2 Output: $ g++-o?ts.cpp Enter a filename: C:VVtmp\Itl.txt This is a DAG Start node (s) 0 Popping-off order: 21 0 Topological sort: 0->2

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!