#### Question

Let G = (V, E) be a weighted, directed graph with weight function w: E → ℝ and no negative-weight cycles. Let s ∈ V be the source vertex, and let G be initialized by INITIALIZE-SINGLE-SOURCE (G, s). Prove that for every vertex

$v ∈ V_π$

, there exists a path from s to in

$G_π$

and that this property is maintained as an invariant over any sequence of relaxations.

Verified

#### Step 1

1 of 2

The only vertex in $\mathrm{V}_{\mathrm{\pi}}$ is $\mathrm{s}$, and there is trivially a path from s to itself. Now suppose that after any sequence of n relaxations, for every vertex $v \in V_{\pi}$ there exists a path from $s$ to $v$ in $G_{m}$. Consider the $(n+1)^{st}$ relaxation. Suppose it is such that $v \cdot d>u \cdot d+w(u, v) .$ When we relax $v,$ we update $v . \pi=u . \pi .$ By the induction hypothesis, there was a path from $\mathrm{s}$ to $\mathrm{u}$ in $\mathrm{G}_{\pi}$. Now $\mathrm{v}$ is in $\mathrm{V}_{\pi}$, and the path from $\mathrm{s}$ to $\mathrm{u},$ followed by the edge $(u, v)=(v \cdot \pi, v)$ is a path from $s$ to $v$ in $G_{\pi},$ so the claim holds.

## Create an account to view solutions

#### Computer Organization and Design MIPS Edition: The Hardware/Software Interface

5th EditionDavid A. Patterson, John L. Hennessy
220 solutions

#### Fundamentals of Database Systems

7th EditionRamez Elmasri, Shamkant B. Navathe
687 solutions

#### Introduction to Algorithms

3rd EditionCharles E. Leiserson, Clifford Stein, Ronald L. Rivest, Thomas H. Cormen
726 solutions

#### Introduction to the Theory of Computation

3rd EditionMichael Sipser
389 solutions