Question: can someone please write the code for this in java?its a data structures and algorithm class. 12 (b) Code the DFS-based algorithm to solve the
12 (b) Code the DFS-based algorithm to solve the topological sorting problem for the graphs. You will need to convert the graphs to an adjacency matrix or an adjacency list. Along with the code, you may submit a sheet describing an alternate labeling for the vertices (e.g. instead of a through g, you use 0 through 6). Run the algorithm. If there is no topological sort of the graph (i.e. the graph is not a dag), print a message to that effect. If there is a topological sort, list the order of the vertices that produce a valid topological sort. Note that there may be more than one valid topological sort. If you print out the vertices using the alternate labeling, you will receive full credit. If you use the original labeling (a-g) you will receive a bonus. V
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
