Question

Problem 6. (Weighted Graph Reduction) Your friend has written an algorithm which solves the all pairs shortest path problem f

For example, consider the following graph G. 7 The output of your algorithm UNWEIGHTEDAPSP must be: (A, B):2, A,C:4, [A, D):3

Problem 6. (Weighted Graph Reduction) Your friend has written an algorithm which solves the all pairs shortest path problem for unweighted undirected graphs. The cost of a path in this setting is the number of edges in the path. The algorithm UNWEIGHTEDAPSP takes the following input and output: UNWEİGHTEDA PSP Input: An unweighted undirected graph G Output: The costs of the shortest paths between each pair of vertices fu, v) For example, consider the following graph G. The output of UNWEIGHTEDAPSP would be: Your task is two use your friend's algorithm UNWEIGHTEDAPSP to solve the all pairs shortest paths problem for weighted undirected graphs. Write an algorithm WeIGhTEDAPSP in pseudocode which makes use of the algorithm UNwEIGHTEDAPSP to solve the problem. Your algorithm must transform its input into an unweighted graph, call UN- WEIGHTEDAPSP, and then interpret the output to correctly compute the costs of the shortest paths for the original weighted graph. The input and output specification of your algorithm must be: Input: A weighted undirected graph G WEIGHTEDAPSP Output: The costs of the shortest paths between each pair of vertices (u, v)
For example, consider the following graph G. 7 The output of your algorithm UNWEIGHTEDAPSP must be: (A, B):2, A,C:4, [A, D):3,B,C) 6, B, D):5, (C, D):7 This type of problem is called a reduction: we have reduced the problem WEIGHTEDAPSP to the problem UNWEIGHTEDAPSP. Reductions show up frequently in computer science, and is of particular importance to complexity theory which is concerned with the "hardness" of different problems. Usually we are concerned with what we refer to as a "polynomial-time reduction", which this problem is not more on this in Week 12!
0 0
Add a comment Improve this question Transcribed image text
Answer #1

3 o 2 3 A-B 2 C 75 B120 65

Add a comment
Know the answer?
Add Answer to:
Problem 6. (Weighted Graph Reduction) Your friend has written an algorithm which solves the all pairs shortest path pr...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT