This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: COT 5405 Analysis of Algorithm Midterm Exam II Solution Problem 1(30pts) . Given an undirected simple weighted graph G = ( V,E ) (having no selfloops or multiedges) with two designated vertices s,t ∈ V and weight w e (unnecessarily positive) for any edge e ∈ E . A path p s,t is said to be shortest from s to t if the aggregate weight of p s,t , defined as c ( p s,t ) = ∑ edge e ∈ p s,t w e , is the smallest among all paths from s to t . A second smallest path is a path p ′ s,t with c ( p ′ s,t ) ≥ c ( p s,t ) and contains at least one different edge from p s,t , while c ( p ′ s,t ) ≤ c ( q ) for any other s − t path q . 1. (15pts) Design an algorithm to find such a second smallest s − t path. Please describe your algorithm and sketch its correctness. Pseudocode is NOT required. 2. (15pts) Two (or more) paths are edgedisjoint if they have no edges in common. The K shortest Edge Disjoint Path Problem is to find the shortest, 2 nd shortest, ··· , K th shortest s − t paths which are EdgeDisjoint. Design an algorithm to find these K paths. Please describe your algorithm and sketch its correctness. Pseudocode is NOT required. ( HINT: translate this into a ﬂow problem. ) 3. ( Bonus 10pts) Two (or more) paths are nodedisjoint if they have no common intermediate nodes. Design an algorithm to find the K shortest NodeDisjoint Paths. Please describe your algorithm and sketch it s correctness. Pseudocode is NOT required. ( HINT : Convert to K shortest EdgeDisjoint Path Problem.) Solution : Note that simple graph is a graph with no selfloop or multiple edges. Directed or undirected simple graphs have the same solution for this question. (1) Use a similar idea of FloydWarshall algorithm. Step 1 : Use FloydWarshall algorithm to find the shortest paths from s to all v ∈ V and those from all v ∈ V to t in O (  V  3 ) time. Denote the shortest path between i and j as π 1 ( i,j ). Initialize the second shortest path as π 2 ( i,j ) with length ( π 2 ( i,i )) = 0 and length ( π 2 ( i,j )) = ∞ for i ̸ = j ....
View
Full
Document
This note was uploaded on 01/15/2012 for the course COT 5405 taught by Professor Ungor during the Fall '08 term at University of Florida.
 Fall '08
 UNGOR
 Algorithms

Click to edit the document details