hw4sol - COT 5405 - HW 04 solution November 17, 2009 1. (a)...

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

View Full Document Right Arrow Icon
COT 5405 - HW 04 solution November 17, 2009 1. (a) If all the edge weights are 1, then for each node, edge relaxation will occur only once, so for that node d[u] will be the shortest distance from the source.Moreover, in extract-min function the nodes are extracted in increasing order of d value. Actually in Relax procedure w(u,v) = 1, so d[v] is set to d[u]+1, when v is parent of u. Priority Queue of Dijkstra and the queue in BFS in this case is related as follows.- (1) At any point in time the BFS queue contains exactly those nodes that the heap in Dijkstra has a d value other than infinity. (2) The Dijkstra priority queue at any time has d values that are of the type x, x+1, infinity or x, infinity (for some integer value x) (3) The decrease key and delete min operation in Dijkstra can therefore be related one to one with the dequeue and enqueue operations in the BFS queue (b) We show that in each iteration of Dijkstras algorithm, d [ u ] = δ ( s,u ) when u is added to S (the rest follows from the upper-bound property). Let N ( s ) be the set of vertices leaving s , which may have negative weights. We divide the proof to vertices in N ( s ) and all the rest. Since there are no negative loops, the shortest path between s and all u N ( s ), is through the edge connecting them to s , hence δ ( ) = w ( ), and it follows that after the first time the loop in lines 7 , 8 is executed d [ u ] = w ( ) = δ ( ) for all u N ( s ) and by the upper bound property d [ u ] = δ ( ) when u is added to S . Moreover it follows that S = N ( s ) after | N ( s ) | 1
Background image of page 1

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

View Full DocumentRight Arrow Icon
steps of the while loop in lines 4-8. For the rest of the vertices we argue that the proof of Theorem 24-6 holds since every shortest path from s includes at most one negative edge (and if does it has to be the first one). To see why this is true assume otherwise, which mean that the path contains a loop, contradicting the property that shortest paths do not contain loops. 2. (a)Observe that MAYBE-MST-A removes edges in non-increasing order as long as the graph remains connected. Then, the resulting T is a minimum spanning tree. The correctness of the algorithm can be shown as follows: let S be a MST of G . When an edge e is about to be removed, either e S or e / S . If e / S ,then we can just remove it. If
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the 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 / 5

hw4sol - COT 5405 - HW 04 solution November 17, 2009 1. (a)...

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