Question: Create a Java program with the following menu: Menu: 1 ) Author info 2 ) Load Graph 3 ) Traverse graph 4 ) Depth First

Create a Java program with the following menu:
Menu:
1) Author info
2) Load Graph
3) Traverse graph
4) Depth First Search
5) Breadth First Search
0) Exit
Menu Option 1
Print program author name and student id
Menu Option 2
Allow the user to enter a file name, then build and adjacency matrix from the data in the selected file. Details for the file are given below
Menu Option 3
Implement a traversal method that lets the user select a starting vertex.
Then inform the user of all neighbors and the cost of traveling to the neighbor, then let the user pick a neighbor to travel to. For full credit (but only a minor penalty if you don't have it) also indicate if the link is bi-directional or uni-directional. "Travel" to the vertex and repeat the process. If the user selects vertex -1 as a destination end the traversal. As you traverse the nodes, keep a total of the costs incurred by the chosen path and inform the user at each step.
Menu option 4
let the user select a starting vertex, then print the order in which nodes are marked as visited for a depth first search
Menu option 5
let the user select a starting vertex, then print the order in which nodes are marked as visited for a breadth first search
Menu option 0
Exit the program
File description:
The first row contains the number of vertices, every row after contains information about a vertex, row 1 contains vertex 0's information, row 2 contains vertex 1's information and so on. for a vertex the first integers is the number of neighbors for that vertex, followed by the weight of an edge, then the connected vertex
_NUMBER_OF_VERTICES
_NUMBER OF NEIGHBORS_ Neighbor1_Weight Neighbor1 Neighbor2_Weight Neighbor2...
for example for the following graph
0
4/\3
/\1
12---------34
The file would be:
55 vertices in graph
24132 vertex 0 has 2 neighbors
140 vertex 1 has 1 neighbor
23013 vertex 2 has 2 neighbors
112 vertex 3 has 1 neighbor
0 vertex 4 has 0 neighbors
file1;
5
21423
104
20331
121
0
file 2
6
21423
104
20331
121
131
0
file 3
12
3141687
3651869
366710111
177
210910
361811610
21062
38073110
211410
161
57294651748
21285
file 4
5
24132
140
23013
112
0
file 5
5
24132
140
23013
112
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!