Skip to main content

Shortest Paths in a Network

 ITCS-6114/8114: Algorithms and Data Structures

Project 1 — Shortest Paths in a Network
See the syllabus for late policies. See below for submission guidelines.
Introduction
Consider a data communication network that must route data packets (email, MP3 files, or video files, for example). Such a network consists of routers connected by physical cables or links. A router can act as a source, a destination, or a forwarder of data packets. We can model a network as a graph with each router corresponding to a vertex and the link or physical connection between two routers corresponding to a pair of directed edges between the vertices.
A network that follows the OSPF (Open Shortest Path First) protocol routes packets using Dijkstra’s shortest path algorithm. The criteria used to compute the weight corresponding to a link can include the time taken for data transmission, reliability of the link, transmission cost, and available bandwidth. Typically each router has a complete representation of the network graph and associated information available to it.
For the purposes of this project, each link has associated with it the transmission time taken for data to get from the vertex at one end to the vertex at the other end. You will compute the best path using the criterion of minimizing the total time taken for data to reach the destination. The shortest time path minimizes the sum of the transmission times of the links along the path.
The network topology can change dynamically based on the state of the links and the routers. For example, a link may go down when the corresponding cable is cut, and a vertex may go down when the corresponding router crashes. In addition to these transient changes, changes to a network occur when a link is added or removed.
Example
Consider a very simplified example of a network at UNCC, with vertices at Belk Gym, Woodward Hall, College of Education, Duke Hall, Grigg Hall, and College of Health and Human Services. See Figure 1 for an illustration. For this example, the shortest time (or fastest) path from Belk (Gym) to (College of) Education is: Belk–Duke–Education with a total transmission time of 0.9 milliseconds.

Figure 1: An example network graph. Each link shown represents two directed edges. Shown next to each link are the associated transmission times of its two edges in milliseconds.
Your Job
You have five tasks in this project: building the initial graph, updating the graph to reflect changes, finding the shortest path between any two vertices in the graph based on its current state, printing the graph, and finding reachable sets of vertices. These are described in turn.
Building the Graph
Your program should run from the command-line:
graph network.txt
where network.txt is a file that contains the initial state of the graph. (Other names besides network.txt may be used, so you cannot hard-code this.) The format of the file is quite simple. Each link representing two directed edges is listed on a line, and is specified by the names of its two vertices followed by the transmission time. Vertices are simply strings (vertex names with no spaces) and the transmission times are floating point numbers. For the above example, the file will look like:
Belk Grigg 1.2
Belk Health 0.5
Duke Belk 0.6
Belk Woodward 0.25
Woodward Grigg 1.1
Grigg Duke 1.6
Health Woodward 0.7
Health Education 0.45
Woodward Education 1.3
Duke Education 0.3
Woodward Duke 0.67
For each input link, add two directed edges, one in each direction.
Changes to the Graph
Input about changes to the graph, requests for shortest paths, and requests to print the graph will come as input queries to be read from the standard input. Here are queries indicating changes to the graph.
addedge tailvertex headvertex transmit time — Add a single directed edge from tailvertex to headvertex. Here headvertex and tailvertex are the names of the vertices and transmit time is a float specifying the transmission time of the edge. If a vertex does not exist in the graph already, add it to the graph. If the edge is already in the graph, change its transmission time. Important note: This can enable two vertices to be connected by a directed edge in one direction and not the other, or enable the transmission times in the two directions to be different.
deleteedge tailvertex headvertex — Delete the specified directed edge from the graph. Do not remove the vertices. If the edge does not exist, do nothing. Note: This may cause two vertices to be connected by a directed edge in one direction, but not the other.
edgedown tailvertex headvertex — Mark the directed edge as “down” and therefore unavailable for use. The response to an edgedown (or edgeup) query should mark only the specified directed edge as “down” (or “up”). So its companion directed edge (the edge going in the other direction) should not be affected.
edgeup tailvertex headvertex — Mark the directed edge as “up”, and available for use. Its previous transmission time should be used.
vertexdown vertex — Mark the vertex as “down”. None of its edges can be used. Marking a vertex as “down” should not cause any of its incoming or outgoing edges to be marked as “down”. So the graph can have “up” edges going to and leaving from a “down” vertex. However a path through such a “down” vertex cannot be used as a valid path.
vertexup vertex — Mark the vertex as “up” again.
Finding the Shortest Path
The query for finding the shortest path will look like path from_vertex to_vertex
where from_vertex and to_vertex are names of vertices. This should compute the shortest time path from from_vertex to to_vertex using Dijkstra’s algorithm and based on the current state of the graph.
The most difficult task is the implementation of Dijkstra’s algorithm, and especially the priority queue (as a min binary heap).
The output must be the vertices along the shortest path, followed by the total transmission time. For example, with our example graph and no changes to the state of the graph, the query path Belk Education should yield as output
Belk Duke Education 0.9
Print Graph
The simple query print
must print the contents of the graph. Vertices must be printed in alphabetical order and the outward edge for each vertex must be printed in alphabetical order. For the example graph, the output should be
Belk
Duke 0.6
Grigg 1.2
Health 0.5
Woodward 0.25
Duke
Belk 0.6
Education 0.3
Grigg 1.6
Woodward 0.67
Education
Duke 0.3
Health 0.45
Woodward 1.3
Grigg
Belk 1.2
Duke 1.6
Woodward 1.1
Health ...
Woodward ...
When a vertex is down, append the word DOWN after the vertex. When an edge is down, append the word DOWN after the edge.
Reachable Vertices
Since the states of the vertices and edges may change with time, it is useful to know the set of vertices reachable from each vertex by valid paths. You must develop and implement an algorithm that identifies for each vertex, the set of all its reachable vertices. You should not use the shortest distance algorithm implemented above to obtain the set of reachable vertices. Important: Additionally, you must describe your algorithm and justify its running time, using “O” notation, in the comments for this algorithm in your submitted code.
The query reachable
must print for each “up” vertex, all vertices that are reachable from it. So vertices that are “down” or not reachable by “up” edges will not be printed. Vertices must be printed in alphabetical order, and the set of vertices reachable from each vertex must be printed in alphabetical order. For example, if only vertices Health and Grigg are reachable from vertex Belk, the output will look
like
Belk
Grigg
Health
Duke ...
Quit
The input query quit should simply cause the program to exit without printing anything.
Project Hints
You should create a Graph class, a Vertex class and an Edge class to hold the relevant vertex and weighted edge information. Use an adjacency list of edges in the vertex class.
The implementation of Dijkstra’s algorithm is perhaps the hardest part of the project. You may like to first implement Dijkstra’s algorithm using an array as the priority queue to maintain the vertex distances, and then implement the min binary heap to achieve the more efficient priority queue implementation.
Remember that the initial information about the network graph will come from a file specified as a command-line argument. The graph you create will be a directed graph with two edges, one in each direction, for each input link. The queries will come from the standard input and the output from your program should go to the standard output. Example input and output files will be posted.
Grading Criteria
The total of 100 points for this project is broken up into:
20 points for proper construction of the graph and outputting a correct description.
35 points for efficiently finding shortest paths using Dijkstra’s algorithm. You will lose 15 points if you do not use a binary heap to implement the priority queue.
15 points for updating the graph based on network changes.
15 points for printing all reachable vertex sets and analyzing the complexity of your algorithm.
15 points for compilation, structure, and documentation.
Within these criteria, your grade will depend on program structure, efficiency, and correct execution.
The structure of your code will be judged for quality of the comments, quality of the data structure design, and especially the logic of the implementation. The comments need not be extremely long: just explain clearly the purpose of each class and each function within each class.
Submission Guidelines
Your submission must include all your source code and a brief report as a README file. Your submission should NOT include any IDE-specific project files, any compiled files, or any executables. Every file should have your name in a comment line at the top. Your README file should have a brief description of your program design, the breakdown of the files, which compiler you used, a summary of what you think works and fails in your program, and a short description of your data structure design.
You will submit your project on Canvas. You should submit a single zip or tar file containing your source code files and README file. You can submit your project multiple times; only the most recent project submission will be graded. The most recent project submission will also be used to compute late days, if any.
Final Warning
A project that does not follow the submission guidelines will receive a 10 point deduction. Proper submission is entirely your responsibility. Contact the TA if you have any doubts whatsoever about your submission. Do NOT submit your project via email. Be sure to keep copies of your files and do not change them after submitting. After grades are posted, you have exactly one week to resolve all problems. After that week is up, all grades are final.
Please observe the academic integrity guidelines in the syllabus, and submit your own work

WE HAVE DONE THIS QUESTION BEFORE, WE CAN ALSO DO IT FOR YOU

GET SOLUTION FOR THIS ASSIGNMENT, Get Impressive Scores in Your Class

CLICK HERE TO MAKE YOUR ORDER

TO BE RE-WRITTEN FROM THE SCRATCH

GET SOLUTION FOR THIS ASSIGNMENT

CLICK HERE TO MAKE YOUR ORDER

TO BE RE-WRITTEN FROM THE SCRATCH

NO PLAGIARISM

  • Original and non-plagiarized custom papers- Our writers develop their writing from scratch unless you request them to rewrite, edit or proofread your paper.
  • Timely Deliveryprimewritersbay.com believes in beating the deadlines that our customers have imposed because we understand how important it is.
  • Customer satisfaction- Customer satisfaction. We have an outstanding customer care team that is always ready and willing to listen to you, collect your instructions and make sure that your custom writing needs are satisfied
  • Confidential- It’s secure to place an order at primewritersbay.com We won’t reveal your private information to anyone else.
  • Writing services provided by experts- Looking for expert essay writers, thesis and dissertation writers, personal statement writers, or writers to provide any other kind of custom writing service?
  • Enjoy Please Note-You have come to the most reliable academic writing site that will sort all assignments that that you could be having. We write essays, research papers, term papers, research proposals Shortest Paths in a Network

ally Written Papers From The Writing Experts 

Green Order Now Button PNG Image | Transparent PNG Free Download on SeekPNG

Comments

Popular posts from this blog

Starting with this provided code, add the following functionality

1.Starting with this provided code, add the following functionality: Replace hardcoded strings “Zero”, “One”, “Two”, “Three” in the ArrayList based on user typed input (use Scanner or JOptionPane classes). The user will be prompted for the String to be stored in the ArrayList and then hit enter. The user will be able to continue to add items to the ArrayList until they just hit enter without typing anything. Once the user does this (hits enter without typing anything), the program will display all of the elements of the ArrayList, both the index and String values, in a table. It will do this via a single loop making use of an iterator method. 2. Starting with this provided code, add the following functionality: Use a Try/Catch block so that the exception is caught and the program exits a bit more gracefully. Save this file as TryCatch.java. (Be sure to rename the Public Class accordingly.) Starting with the provided code again (without the Try/Catch block), fix the code so that

Josie Eskander

  Question 1: Task 1: Report Assume you are Josie Eskander. You are writing in response to techno trading P/L’s advertisement of a new laptop at 20% below normal price. You want information on brand name, availability of service and repairs, delivery times and methods of payment. Write the letter using the seven basic parts of the letter. In the opening paragraph present a clear and courteous request. Secondly write a response from techno trading giving details and proposing the sale. Provide draft of both emails in the space below. Question 2: Task 2: Report In pairs, nominate a good and a bad letter writer. Discuss the key differences. Write a good/bad letter from techno training to Alex Antonov accepting/declining his proposal to invest in the business Question 3: Task 3: Report Write a letter from techno trading p/l to a new client ‘new realities p/l’ urging them to buy techno new virtual reality software. Make a strong argument for the product. Question 4: Task 4: Report Write a l

Sandra Coke is vice president for research and development at Great Lakes Foods (GLF), a large snack food company that has approximately 1,000 employees

Chapter 2 I Trait Approach 33 CASE 2.1 Choosing a New Director of Research Sandra Coke is vice president for research and development at Great Lakes Foods (GLF), a large snack food company that has approximately 1,000 employees. As a result of a recent reorganization, Sandra must choose the new director of research. The director will report directly to Sandra and will be responsible for developing and testing new products. The research division of GLF employs about 200 people. The choice of directors is important because Sandra is receiving pressure from the president and board of GLF to improve the company's overall growth and productivity. Sandra has identified three candidates for the position. Each candidate is at the same managerial level. She is having difficulty choosing one of them because each has very strong credentials. Alexa Smith is a longtime employee of GLF who started part-time in the mailroom while in high school. After finishing school, Alexa worked in as many as