Exercise Lover

June 22, 2007

Exercises 22.5-7

Filed under: 22.5 — yuhanlyu @ 1:54 pm
  1. Construct component graph.
  2. Topological sort
  3. Check whether it has a linear chain, if yes then return “Yes”.

The running time is O(|V|+|E|).
If u and v are in the same component, then there is a path from u to v. If u and v are in different component, since the component graph is a linear chain. There is one path from u to v or v to u.

Exercises 22.5-6

Filed under: 22.5 — yuhanlyu @ 1:50 pm

We can reduce the subgraph in one component to a cycle. Then this graph has the same component graph and has fewest edges.

Exercises 22.5-5

Filed under: 22.5 — yuhanlyu @ 1:47 pm

In the SCC’s algorithm, we can compute the component’s numbering. Then we can find all edges which endpoints are in different components. These edges are the edges in the component graph. But the graph is not simple graph, we must transform it into simple graph.

Exercises 22.5-4

Filed under: 22.5 — yuhanlyu @ 1:38 pm

G’s transpose’s component graph, is G’s component graph’s transpose. Hence they are equivalent.

Exercises 22.5-3

Filed under: 22.5 — yuhanlyu @ 1:28 pm

Incorrect. Let G=(V,E), V={0,1,2}, E={<0,1>,<0,2>,<1,0>}. If we start DFS with node 0, then the result is incorrect.

Exercises 22.5-2

Filed under: 22.5 — yuhanlyu @ 1:20 pm

Exercises 22.5-1

Filed under: 22.5 — yuhanlyu @ 1:20 pm

It may decrease by at most |V|-1 component. Thinking about a directed path with |V| nodes, the number of components is |V|. If we add a edge that the graph becomes a cycle, then the number of components is 1.

Blog at WordPress.com.