This preview shows page 1. Sign up to view the full content.
Unformatted text preview: is unreachable from s). Carrie doesn’t trust Lazarus very much, and wants to write a “checker” routine that checks the output of Lazarus’s code (in some way that is more efﬁcient than just recomputing the answer herself). Carrie writes a “checker” routine that checks the following conditions. (No need for her to check that w(u, v ) is always non-negative, since she creates this herself to pass to Lazarus.) (i) d[s] = 0 (ii) π [s] = N IL (iii) for all edges (u, v ) : d[v ] ≤ d[u] + w(u, v ) (iv) for all vertices v : if π [v ] = N IL, then d[v ] = d[π [v ]] + w(π [v ], v ) � (v) for all vertices v = s : if d[v ] < ∞, then π [v ] = N IL (equivalently: π [v ] = N IL =⇒ d[v ] = ∞) � � 1. Show, by means of an example, that Carrie’s conditions are not sufﬁcient. That is, Lazarus’s code could output some...
View Full Document
- Spring '08