Question: Modify Listing 28.2, TestGraph.java, to create a file representing graph1. The file format is described in Programming Exercise 28.1. Create the file from the array
Modify Listing 28.2, TestGraph.java, to create a file representing graph1. The file format is described in Programming Exercise 28.1. Create the file from the array defined in lines 8–21 in Listing 28.2. The number of vertices for the graph is 12, which will be stored in the first line of the file. The contents of the file should be as follows:

Data from Programming Exercise 28.1.
Write a program that reads a graph from a file and determines whether the graph is connected. The first line in the file
contains a number that indicates the number of vertices (n). The vertices are labeled as 0, 1, . . . , n−1. Each subsequent line, with the format u v1 v2 ..., describes edges (u, v1), (u, v2), and so on. Figure 28.21 gives the examples of two files for their corresponding graphs.

Data from Listing 28.2

12 0 1 35 10 2 3 213 4 10 301245 4 2 357 8 10 503 4 67 6 57 7 45 6 8 8 479 10 11 9 8 11 10 2 4 8 11 11 8 9 10
Step by Step Solution
3.41 Rating (164 Votes )
There are 3 Steps involved in it
public class Exercise2802 public static void mainString args throws javaioFileNotFoundException String vertices Seattle San Francisco Los Angeles Denver Kansas City Chicago Boston New York Atlanta Mia... View full answer
Get step-by-step solutions from verified subject matter experts
