Question: I have an assaignment from Data Structures and Algorithms. The question should be solved with Java and using graph structure. The input is written below

I have an assaignment from Data Structures and Algorithms. The question should be solved with Java and using graph structure. The input is written below of first paragraph. I will attach the image of the assaignment. You have a map of Turkey, and you want to start from one city and finish your trip
in another city. However, there may be cities you want to visit during this trip.
Therefore, you have to visit these cities as well. In this question, your task is to
find the shortest route from your starting city to your ending city. This route should
also include the cities you want to visit. You should read Turkey map from the .txt
files which shown in following image:
Eskisehir, Ankara, 10
Eskisehir, Bolu, 20
Eskisehir, Bilecik, 5
Eskisehir, Kutahya, 30
Eskisehir, Afyonkarahisar, 50
Eskisehir, Cankiri, 10
Eskisehir, Kastamonu, 5
Cankiri, Kastamonu, 12
Ankara, Istanbul, 14
Istanbul, Cankiri, 30
Kastamonu, Corum, 14
Corum, Amasya, 14
Amasya, Tokat, 12
You should read this file line by line and construct an undirected graph with
given weight. For example, the first line means that there is a path between
Eskisehir and Ankara with length of 10.
To find a shortest path, first you should read source city, destination city and
number of cities which you want to visit, and name of these cities from the
console, respectively. If there is more than one city to visit, you should visit them
based on console order. For example, you read cities to visit from the console as A,
B, C. Then, you should keep this order during your trip and first visit A,then B, then C.
Example inputs/outputs are as follow: input.txt // you should read input txt file from the user
Eskisehir // source city
Kastamonu //destination city
0// number of city you want to visit
Routes are:
Eskisehir-Kastamonu
Length of route is: 5 input.txt // you should read input txt file from the user
Eskisehir // source city
Kastamonu //destination city
1// number of city you want to visit
Cankiri // City to visit
Routes are:
Eskisehir-Cankiri-Kastamonu
Length of route is: 22
 I have an assaignment from Data Structures and Algorithms. The question

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