Exercise Lover

July 1, 2007

Problems 25-2

Filed under: Problem 25 — yuhanlyu @ 1:15 pm

(a) Insert =O(\log_d n), Extract-Min = O(d \log_d n), Decrease-Key = O(\log_d n). If d = \Theta(n^{\alpha}), the Insert and Decrease -Key will become O(\frac{1}{\alpha}) and Extract-Min will become O(\frac{n^\alpha}{\alpha}).

(b) Let d = \Theta(|V|^{\epsilon}), the complexity will become O(|E|).

(c) Run (b) for |V| times.

Problems 25-1

Filed under: Problem 25 — yuhanlyu @ 1:14 pm

a. Let the new added edge be (u,v). If there are nodes u,v such that i is transitive to u, v is transitive to j. Then i is transitive to j in the G*.

b. Let G be one directed path start from u and stops in v. If we add edge (v,u), then all nodes in the graph are transitive to each other.

c. If i is transitive to v, then add edge (u,v) is no help to i and j. We can check this condition explicitly. Although there are O(|V|^2) possible insert edges, but the situations which meet i is transitive to u and i is not transitive to v are only O(|V|^2) possibilities. Hence, we can insert O(|V|^2) edges in O(|V|^3) time.

Exercises 25.3-6

Filed under: 25.3 — yuhanlyu @ 1:05 pm

If the graph is not strongly connected, the modification will not work.

If the graph is strongly connected, then for every vertex v, h(v) is well-defined and the nonnegative property is preserved.

Exercises 25.3-5

Filed under: 25.3 — yuhanlyu @ 1:05 pm

According to (25.9), we know w’(u,v) = w(u, v) + h(u) – h(v), h(u) is the shortest path from s to u. If (u,v) is a edge in the cycle, then the shortest path from v to u is -w(u,v). Suppose that w(u,v) is positive, h(v) will be 0 and h(u) will be -w(u,v), so w(u,v) + h(u) – h(v) = 0. The case of w(u,v) is negative is symmertic.

Exercises 25.3-4

Filed under: 25.3 — yuhanlyu @ 1:04 pm

It will change the shortest path. The path with more edges will be added more weight.

Exercises 25.3-3

Filed under: 25.3 — yuhanlyu @ 1:02 pm

Because w(u,v) ≥ 0 for all edges, the shortest from s to every vertex v must be edge (s,v)  which weight is 0. Hence the codomain of function h has only one element — 0 and w and w’ must be identical.

Exercises 25.3-2

Filed under: 25.3 — yuhanlyu @ 1:01 pm

Because we want to find a suitable function h.

Exercises 25.3-1

Filed under: 25.3 — yuhanlyu @ 1:01 pm

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.

Older Posts »

Blog at WordPress.com.