Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question 2. (1 marks) Suppose we have a road network between cities numbered from 1 to n. Each road connects a pair of cities, and
Question 2. (1 marks) Suppose we have a road network between cities numbered from 1 to n. Each road connects a pair of cities, and can be traveled in both directions. The entire road network is represented by an undirected graph G (V, E), where V -1,... ,n) are the cities, and the edges E are the roads. Assume that the road network, i.e. the graph G, is connected. There are k roads which have been damaged, and your goal is to choose which roads to repair, so that the there is a path between each pair of cities, and the total cost of repairs is minimized. The roads E are given to you in an array R[1.. m], where each array cell Ri contains two fields: Ri].edge which contains the pair (u,v) of cities that the i-th road connects, and R[i]. cost which contains the cost of repairing the road, if it is damaged, or 0 if it is not. The cost of repairing a damaged road can be assumed to be positive. Design an algorithm to compute a set of damaged roads to be repaired, so that, after the repairs, it is possible to travel between every pair of cities by following roads that are either undamaged or repaired. Moreover, the total cost of repaired roads should be minimized. Your algorithm should have worst-case running time at most O(m logm k log k). Describe your algorithm in clear and concise English, prove it is correct, and analyze its running time
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started