Question: Define a new class named UnweightedGraphWithGetPath that extends UnweightedGraph with a new method for finding a path between two vertices with the following header: public
Define a new class named UnweightedGraphWithGetPath that extends UnweightedGraph with a new method for finding a path between two vertices with the following header:
public List getPath(int u, int v);
The method returns a List that contains all the vertices in a path from u to v in this order. Using the BFS approach, you can obtain the shortest path from u to v. If there isn’t a path from u to v, the method returns null. Write a test program that creates a graph for Figure 28.1. The program prompts the user to enter two cities and displays their paths. Use https://liveexample.
pearsoncmg.com/test/Exercise28_05.txt to test your code. Here is a sample run:

Seattle (0) Boston (6) Chicago (5) Denver (3) New York (7) San Francisco (1) Kansas City (4) Los Angekes (2) Dallas (10) Alanta (8) Houston (11) Miami (9)
Step by Step Solution
3.42 Rating (165 Votes )
There are 3 Steps involved in it
import javautil import javaio public class Exercise2805 public static void mainString args throws Exception new Exercise2805 public Exercise2805 throws Exception String vertices Seattle San Francisco ... View full answer
Get step-by-step solutions from verified subject matter experts
