Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Implement a new class for graphs with weighted edges. Either you use the ordinary Graph class as a superclass for your implementation, or you start it from scratch by following the pattern used in the ordinary Graph class. The ordinary Graph class is implemented by Michael Main which can be downloaded from his website.

After implementing the new class, provide two extra methods to implement Dijkstra's shortest distance and shortest path algorithms as described on pages 732-743 of the third edition or pages 760-771 of the fourth edition. Please carefully read the algorithm explanation and examples in those pages so that you fully understand the whole algorithms.

The shortest path algorithms only differ from the base shortest distance algorithm in keeping a record of previous vertex for each vertex. It would be helpful to write a method for printing a path from the start vertex to a given vertex as a list of vertices on the path.
After you implement the weighted graph as requested above, write a program to help a traveler plan the shortest traveling path from one city to another. I expect your program should read a file of data containing information about a group of cities and create a graph for this group of data. The file takes the following format. In the first line of the file is the number of cities interested in the program. Then each line of the file contains three integers. The first two are the indices of cities and the third one is the distance between two cities indexed by indices (suppose that distances are integers). There is another file consisting of pairs of index (an integer) and city names (String). Doing so can make your program simpler in building graph objects. Your program needs to read in the second file too.

For example, the below may be the content of such as files:

distance.txt
5
0 3 215
1 3 731
2 4 337
4 0 280
1 2 823
Index.txt
0 town 1
1 town 2
2 town 3
3 town 4
4 town 5

Please produce your own distance and index files so that you must have at least twenty cities and specify at least 30 distances. You don't need to provide the actual distance between known cities.
Finally your program allows the user to enter queries of the form "City1, City2" and have the program print the shortest sequence of path to travel from City1 to City2.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M91597993
  • Price:- $20

Priced at Now at $20, Verified Solution

Have any Question?


Related Questions in Computer Engineering

The sunshine health corporation has requested you evaluate

The Sunshine Health Corporation has requested you evaluate their Scottsdale, Arizona facility. The original structure was built in 1965. The facility has undergone several remodels aesthetically, with no real infrastruct ...

What are the differences between four types of economics

What are the differences between four types of economics evaluations and their differences with other two (budget impact analysis (BIA) and cost of illness (COI) studies)?

Question suppose a problem can be solved with two different

Question : Suppose a problem can be solved with two different algorithms, A or B. Algorithm A has a time complexity of TA = 17n, and algorithm B has a time complexity of TB = 0.5n 2 . Give the range of n for which it is ...

How do you apply the five components of the information

How do you apply the five components of the information systems to an information systems application like "online bill pay" system offered by many banks.

This subject is computer architecture organizationdraw a

This subject is computer Architecture organization Draw a flowchart showing the steps for a CPU program that uses programmed I/O to send a string consisting of 10 characters to a printer connected through a UART interfac ...

You are required but not limited to turn in the following

You are required, but not limited, to turn in the following source file: Requirements to get full credits in Documentation The assignment number, your name, StudentID, Lecture number(time), and a class description need t ...

Suppose our task is to distinguish between humans and

Suppose our task is to distinguish between humans and non-human objects in an image, which classifier would you choose and why? Decision trees, perceptrons or neural nets.

Question project risk management planpurpose this project

Question: Project: Risk Management Plan Purpose: This project provides an opportunity to apply the competencies gained in the lessons of this course to develop a risk management plan for a fictitious organization to repl ...

How do you calculate the number of peaks and mass when

How do you calculate the number of peaks and mass when Bromine with two isotopes and phosphate with one isotope are put through a mass spectrometer? The formula is PBr3

Question nested lists and cascading style sheetsdeliverable

Question: Nested Lists and Cascading Style Sheets Deliverable: Three (3) Web pages and two (2) Cascading Style Sheets (.css) Complete the weekly lab based on the following: • Write the code for each lab assignment. • The ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As