Question: Start with the given Java program prog 3 4 0 , which lets you select a file to read from your computer, reads the file,

Start with the given Java program prog340, which lets you select a file to read from your computer,
reads the file, and interprets that file as the specification of a graph.1
Read a file of the name
F[]a.txt, which will correspond to a complete directed graph; that is, a graph in which each
pair of vertices (a.k.a., nodes) are connected by edges (a.k.a., arcs) in each direction. Each node in the file
will have a value from 1 through n where n is the number of nodes in the graph.
List the order of the cities visited, then print out the total distance traveled if you start at city with value 1,
then go to cities 2,3, etc. in order, then at the end (after you reach city n), you go back to city 1.
By the way, starting at one city, visiting every other city without visiting any city twice without going
through any city a third time, and coming back home is known as a Hamiltonian Cycle (or Rudrata
Cycle). Finding the shortest Hamiltonian cycle in a graph is known as the Traveling Salesperson
Problem.
Notes:
1. Values are Strings, in future programs they will be alphanumeric, so you need to treat the value as
a String and convert it to an int for processing in Deliverable A (presumably using the
Integer.parseInt(...) method of the Integer class).
2. Print the abbreviations for vertices (cities), not their names.
Thank you so much!
Start with the given Java program prog 3 4 0 ,

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 Programming Questions!