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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 01:00, joedawg50
What is added to the < meta > tag to describe the encoding type?
Answers: 1
image
Computers and Technology, 22.06.2019 11:00, najerajulio
What is the foundation for proper monitoring, load balancing and routing in distributed systems
Answers: 3
image
Computers and Technology, 22.06.2019 22:40, nsuleban9524
When you type the pwd command, you notice that your current location on the linux filesystem is the /usr/local directory. answer the following questions, assuming that your current directory is /usr/local for each question. a. which command could you use to change to the /usr directory using an absolute pathname? b. which command could you use to change to the /usr directory using a relative pathname? c. which command could you use to change to the /usr/local/share/info directory using an absolute pathname? d. which command could you use to change to the /usr/local/share/info directory using a relative pathname? e. which command could you use to change to the /etc directory using an absolute pathname? f. which command could you use to change to the /etc directory using a relative pathname?
Answers: 3
image
Computers and Technology, 23.06.2019 01:20, sosick90501
Write a function balancechemical to balance chemical reactions by solving a linear set of equations. the inputs arguments are: reagents: symbols of reagents in string row array products: symbols of products in string row array elements: elements in the reaction in string row array elcmpreag: elemental composition of reactants in two dimensional numeric array elcmpprdcts: elemental composition of prducts in two dimensional numeric array hint: the first part of the problem is setting up the set of linear equations that should be solve. the second part of the problem is to find the integers from the solution. one way to do this is to mulitiply the rational basis for the nullspace by increasing larger integers until both the left-and right-side integers exist. for example, for the reaction that involves reacting with to produce and : reagents=["ch4", "o2"]; products =["co2", "h2o"]; elements =["c","h", "o"] elcmpreag=[1,4,0;
Answers: 3
You know the right answer?
You are the chief trade minister under Emperor Caesar Augustus with the job of directingtrade in the...

Questions in other subjects:

Konu
Mathematics, 19.03.2021 19:50
Konu
Mathematics, 19.03.2021 19:50
Konu
Mathematics, 19.03.2021 19:50