New class for graphs with weighted edges

Assignment Help Basic Computer Science
Reference no: EM13925112

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.

Reference no: EM13925112

Questions Cloud

Generally used in preparing a statement of cash flows : One of Astro Company's activity cost pools is machine setups, with estimated overhead of $150,000. Astro produces sparklers (400 setups) and lighters (600 setups). How much of the machine setup cost pool should be assigned to sparklers?
What is a non-cyclical industry and give a few examples : What is a non-cyclical industry? Give a few examples. What other industries would be impacted, either concurrently or shortly thereafter?
Wi-fi security in a wireless network : Create a policy for 802.11 Wi-Fi security in a wireless network in a 500-employee company with a 47-access point WLAN. This is not a trivial task.
Effective compensation and benefit system : How an effective compensation and benefit system contributes to organizational effectiveness. The principle components of your revised compensation and benefit system for a large-scale organization as well as a recommendation for each component.
New class for graphs with weighted edges : 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..
Compute ending inventory : Boyne Inc. had beginning inventory of $18,000 at cost and $20,900 at retail. Net purchases were $131,590 at cost and $181,700 at retail. Net markups were $11,100; net markdowns were $8,200;
Analyze the key reasons for the divergent performance : Read a business newspaper or other business publications and identify four industries that are doing well currently and four industries that are under-performing. Analyze the key reasons for the divergent performance.
Analysis-companies does have strong strategic intent posture : Conduct a thorough and well-argued analysis that provides evidence that one of your chosen companies does have a strong strategic-intent posture.
Successfully funding your business venture : For Assignment 1, you imagined that you were going to start a company that offered an innovative product or service. In Assignment 1 you also determined the business structure you would use for that venture. For this assignment, you can use that s..

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd