Exercise Lover

July 1, 2007

Exercises 25.2-9

Filed under: 25.2 — yuhanlyu @ 1:00 pm

First, we should compute the strongly connected component graph. Then we use the component graph to run the transitive closure algorithm.

Exercises 25.2-8

Filed under: 25.2 — yuhanlyu @ 12:58 pm

We can run DFS at most |V| times to get the transitive closure.

Exercises 25.2-7

Filed under: 25.2 — yuhanlyu @ 12:57 pm

If \phi_{ij}^k = m, then we print the path i to m and m to j recursively. In this way, the algorithm is difficult slightly.

Exercises 25.2-6

Filed under: 25.2 — yuhanlyu @ 12:54 pm

Check the diagonal. Otherwise we can run more one iteration, if d^{n+1}d^n, then there is negative cycle.

Exercises 25.2-5

Filed under: 25.2 — yuhanlyu @ 12:52 pm

Yes.

Exercises 25.2-4

Filed under: 25.2 — yuhanlyu @ 12:48 pm

We know that d_{ik}^k = d_{ik}^{k-1}, since node k can not be intermediate node on the path from i to k. Similarly, d_{kj}^k = d_{kj}^{k-1}.

Exercises 25.2-3

Filed under: 25.2 — yuhanlyu @ 12:44 pm

When updating the d_{ij}^k value, we also update the π value.

Exercises 25.2-2

Filed under: 25.2 — yuhanlyu @ 12:42 pm

We can use the OR and AND operation to replace the multiply operation in the algorithm.

Exercises 25.2-1

Filed under: 25.2 — yuhanlyu @ 12:40 pm

Blog at WordPress.com.