mid2sol - COT 5405 Analysis of Algorithm Mid-term Exam II...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: COT 5405 Analysis of Algorithm Mid-term Exam II Solution Problem 1(30pts) . Given an undirected simple weighted graph G = ( V,E ) (having no self-loops or multi-edges) 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 edge-disjoint 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 Edge-Disjoint. 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 flow problem. ) 3. ( Bonus 10pts) Two (or more) paths are node-disjoint if they have no common intermediate nodes. Design an algorithm to find the K shortest Node-Disjoint Paths. Please describe your algorithm and sketch it- s correctness. Pseudocode is NOT required. ( HINT : Convert to K shortest Edge-Disjoint Path Problem.) Solution : Note that simple graph is a graph with no self-loop or multiple edges. Directed or undirected simple graphs have the same solution for this question. (1) Use a similar idea of Floyd-Warshall algorithm. Step 1 : Use Floyd-Warshall 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.

Page1 / 4

mid2sol - COT 5405 Analysis of Algorithm Mid-term Exam II...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online