The file citypairs.dat contains selected city pairs and their distances. Each line of the file contains 2 city names and a distance. Write a program to calculate the shortest path between any given city pair. Your program should do the following:

Read in the city pairs and distances.

Implement Dijkstra's algorithm using as the edge cost the given city pair's distance. You should use the priority queue implementation of Dijkstra's algorithm. Input should be via a Java GUI window that asks for the source and destination cities.

Map the cities onto the window and draw the shortest path in the window between those cities. A list of (X,Y) coordinates for each of the cities can be found in the file cityxy.txt. Display in the window the path length of the shortest path.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.