hw6-sol[1] - Solutions to Homework 6 Debasish Das EECS...

Info iconThis preview shows pages 1–3. 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: Solutions to Homework 6 Debasish Das EECS Department, Northwestern University ddas@northwestern.edu 1 Problem 5.24 We want to find light spanning trees with certain special properties. Given is one example of light spanning tree. Input: Undirected graph G = (V,E); edge weights w e ; subset of vertices U V Output: The lightest spanning tree in which the nodes of U are leaves (there might be other leaves in this tree as well) Consider the minimum spanning tree T = (V, E ) of G and the leaves of the tree T as L(T). Three possible situations are feasible U L ( T ) U = U 1 U 2 where U 1 L ( T ) U 2 V- L ( T ) Note that when U satisfies Equation 1, the algorithm we are seeking is same as Kruskals algorithm. Define a graph G =( V- U , { ( u,v ) : u,v V- U ( u,v ) E } ). Lemma 1 If there is no minimum spanning tree of the graph G , then lightest spanning tree with U vertices as leaves is not feasible Proof: Consider that no spanning tree for the graph G exists. Without any loss of generality assume that there are two trees in the spanning tree forest for the graph G . The lightest spanning tree of G must be a tree. Therefore some node u U must connect the two tress in the spanning tree forest of the graph G . But then u is no longer a leaf node which is a contradiction. Property 1 Minimum spanning tree obtained on the graph G is the lightest spanning tree if we greedily select and add edges such that all vertices U are leaves Proof: The minimum spanning tree T is well defined on the graph G . Consider each node u U . We greedily select an edge ( u,v ) : v T and add the edge ( u,v ) to T . Note that the edge ( u,v ) we greedily chose, v T . If v / T then v U . But we cannot choose such an edge because to form a spanning tree either of u or v must be connected to T but connecting one of them (suppose u ) to T will no longer keep u as leaf. Cost of the new tree is cost ( T ) + w ( u,v ) . Since cost ( T ) is optimal and we cannot select any edge other than ( u,v ) (because of the constraint on U vertices as leaves), cost of the new tree is lightest (cannot be decreased any further). Based on Lemma 1 and Property 1 we present the following algorithm procedure lightest-spanning-tree(G,w,U) Input: Graph G = (V,E); edges weights w e ; U V Output: Lightest spanning tree if exists Construct graph G = ( V , E ) : 1 V = V- U E = { ( u,v ) : u,v V- U ( u,v ) E } Apply Kruskal to get MST( G ) = T : if T does not exist: lightest spanning tree infeasibile Construct edge set E : ( u,v ) E : u U v / U for each u U : makeset(u) sort the edges E by w e for all edges u,v E, in increasing order of weight: if find(u) 6 = find(v): add edge u,v to T union(u,v) return T Complexity analysis: Other than construction of edge set E , rest of the complexity analysis is analogous to Kruskals algorithm which runs in O(...
View Full Document

This document was uploaded on 05/20/2011.

Page1 / 6

hw6-sol[1] - Solutions to Homework 6 Debasish Das EECS...

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

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