Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please solve it eith Java. In this homework, you must implement your own graph data structure by taking inspiration from your textbook and use it
Please solve it eith Java. In this homework, you must implement your own graph data structure by taking inspiration from your
textbook and use it to help to solve problem. You are not allowed to use any external library or jar file.
Any solutions without using graph data structure are not evaluated!
Q points:
Imagine you established a new electricity distribution company. For each you should use
one electricity pole and you should use the minimum number of poles that will provide
electricity to cities you are responsible for. For this reason, you need to create a kind of map.
The inpul.lxl file given to you contains the name and coordinates and respectively of the
cily. Fxample inpul. Ixt is as follows:
You should read inpul. lile, and construct your graph based on this information. For example,
the first line means that City is on coordinate and or the second line means that City
is on coordinate
You can assume that there is always a path between any two cities and you should use
Euclidian distance to calculate length of this path. For example, there is a path from cities D to
and to Their lengths are equal to
Example visualization of citics and paths are as follow for input.txt:
Your goal is to find paths to provide electricity to all cities and require the use of the least
number of poles. While printing, you should print the path in aseending order of their length.
Also, your path starts with city which comes from alphabctically first.
Here is example input and output: Input.txt you should read txt file name from the user
Paths are: you should print shortest path first. And path should start with
BC: city name which comes from alphabetically first.
AE:
AD:
AB:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started