Question: Write a Java program that does the following: a) Reads an input text file like the one described below. The text file contains the
Write a Java program that does the following: a) Reads an input text file like the one described below. The text file contains the description of a directed, unweighted, acyclic graph. b) Construct an adjacency matrix representing the graph. c) Perform topological sorting d) Display the result of the sort. Here's the description in detail: The input file will contain a number of lines. The first line will be an integer representing the num- ber of vertices in a directed, unweighted graph. You can also assume that the graph is acyclic (this is a requirement for topological sorting). Each following line will contain a pair of uppercase char- acters (A-Z) separated by tabs. These pairs represent a graph's edges. 5 SEEAABD E A A ABBDOU The sample input file describes the following graph: B C D C
Step by Step Solution
3.45 Rating (148 Votes )
There are 3 Steps involved in it
This program first reads the number of vertices from the input file Then it reads each line of the f... View full answer
Get step-by-step solutions from verified subject matter experts
