(Find paths) 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...


(Find paths) 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. Here


is a sample run:




Dec 19, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here