subject

You are the chief trade minister under Emperor Caesar Augustus with the job of directingtrade in the ancient world. The Emperor has proclaimed thatall roads lead to (and from)Rome; that is, all trade must go through Rome. In particular, you are given a stronglyconnected directed graph G= (V, E) with positive edge weights, and there is a particularnodev0∈V(Rome). Give an efficient algorithm for finding shortest path betweenall pairsof nodes, with the one restriction that these paths must all pass through v0 (Rome). Make your algorithm as efficient as you can, perhaps as fast as Dijkstra’s algorithm. Required:
a. Give the efficient algorithm.
b. Occasionally, Augustus will ask you for the (smallest) distance between two vertices. Youwant to do this as quickly as possible, so that Augustus does not have your head. This is called adistance query: Given a pair of vertices (u, v), give the the distance ofthe shortest path that passes throughv0. Describe how you might store the results suchthat you require O(|V|) storage and from your data structure you can compute the result in O(1) time. For your answer, a clear description of the data structure and its usage issufficient.
c. On the other hand, the traders need to know the paths themselves. This is called apath query: Given a part of vertices (u, v), give the shortest path itself, that passes throughv0. Describe how you might store the results such that you requireO(|V|) storage and from your data structure you can compute the result in O(|V|) time. Again, a clear description of the data structure and its usage is sufficient.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 12:00
If you're using an existing powerpoint presentation that will receive new slides based on a word outline, select the a. slide that will appear after the new slides. b. first slide in the presentation. c. slide that will appear before the new slides. d. last slide in the presentation.
Answers: 2
question
Computers and Technology, 23.06.2019 22:20
Learning sign language is an example of a(n) learning sign language is an example of a(n)
Answers: 2
question
Computers and Technology, 24.06.2019 00:40
To maintain clarity and focus lighting might be needed
Answers: 2
question
Computers and Technology, 24.06.2019 02:30
Assume a class window with accessor method getwidth that accepts no parameters and returns an integer. assume further an array of 3 window elements named winarr, has been declared and initialized. write a sequence of statements that prints out the width of the widest window in the array.
Answers: 2
You know the right answer?
You are the chief trade minister under Emperor Caesar Augustus with the job of directingtrade in the...
Questions
question
Mathematics, 26.02.2021 17:30
question
Mathematics, 26.02.2021 17:30
question
Mathematics, 26.02.2021 17:30
Questions on the website: 13722367