Question: We are given a directed graph G = ( V , E ) with positive weight function: w : E - > R > 0
We are given a directed graph G V E with positive
weight function: w : E R and two vertices s t in V Suppose we have already
computed the d and pi array using the Dijkastras algorithm: dv is the length of the
shortest path from s to v and pi v is the vertex before v in the path.
Please design a dynamic programming algorithm ie Define subproblems, establish
recurrence relations between subproblems, compute the base case, write the dynamic
programming algorithm pseudocode to count the number of shortest paths from s to t
in On log n m time where n V and m E
Hint: use the d and pi array to help solve the counting problem. You do not need to
worry about the integer overflow issue. That means, you assume a word can hold a very
big integer, and basic operations over these big integers take O time.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
