Title: Homework solution
1Homework solution
- Problem 2. The number of odd degree vertices in a
graph is even. - (recom. book G. Harary Graph Theory)
- Solution Let G(V,E,w)
- S?v?Vdeg(v) 2?, ?E
- Let SS1S0 , where S1 ?v odd deg(v)
- S0 ?v even deg(v)
- S is even, S0 is even (sum of even numbers) ?
- S1 is even. Since S1 is a sum of odd numbers,
it has - to be an even numbers of odd degree vertices in
G.
2Homework solution
- Problem 1. Graph G is Eulerian ? D(G) is
bipartite. - Solution definitions
- Face of a planar graph cycle without
diagonals - Given graph G(V,E) with the set of faces F.
- G is dual to G if G(F,E) s.t. for any face
f?F there is a vertex f?F of graph G, for any
edge e?E there is an edge e?E (1-1
correspondence) such that if e?f1, f2, then
e(f1,f2).
1st face (cycle goes counterclockwise)
2nd face (cycle goes clockwise)
3Homework solution
Problem 1.
2
2
1
F2
2
1
F1
1
2
- Each face is even in D(G)
- Each node is even in G ? then each cycle is even
- F1F2F1?F2 \ F1? F2 make a characteristic
vector - e1 e2 ... ei ... e10
- (0 0 1 0) C1 (01100100)
- C2 (01001000)
4Homework solution
- Problem 1.
- F1 (0001110001)
- F2 (1111000000)
- C(1110110001)
- if our face is even ? then every cycle is even
- Bipartite graph
- Theorem
- Graph G is bipartite iff G does not have odd
cycles. - ? Graph will not have odd cycles because the dual
is Eulerian.
5Planar bipartite graph
- Theorem Graph G is bipartite ? G does not have
odd cycles. - Problem (The T-join problem)
- Given a planar, not bipartite, graph G (V,E).
- Find the set H with the minimum number of edges
such that G (V, E \ H) is bipartite. - Solution Construct the dual graph D(G). G not
bipartite ? D(G) is not Eulerian ? D(G) has at
least 2 odd-degree vertices. Take 1 edge from the
odd degree vertex, then delete the corresponding
edge in the original graph.
6Planar bipartite graph
- Solution we are deleting edges in D(G) to get
Eulerian graph. D(G) Eulerin ? G bipartite. - Any solution consists of paths in G matching
odd-degree vertices. - We need to find minimum size such paths that
match odd-degree vertices.
All solutionspaths matching odd nodes
7The T-join Problem
- How to delete minimum-cost set of edges from
graph G to eliminate odd cycles? - Construct geometric dual graph Ddual(G)
- Find odd-degree vertices T in D
- Solve the T-join problem in D
- find min-weight edge set J in D such that
- all T-vertices have odd degree
- all other vertices have even degree
- Solution J corresponds to desired min-cost edge
set in graph G
8Optimal Odd Cycle Elimination
conflict graph G
dual graph D
T-join odd degree nodes in D
9T-join Problem in Sparse Graphs
- Reduction to matching
- construct a complete graph T(G)
- vertices T-vertices
- edge costs shortest-path cost
- find minimum-cost perfect matching
- Typical example sparse (not always planar)
graph - note that conflict graphs are sparse
- vertices 1,000,000
- edges ? 5 ? vertices
- T-vertices ? 10 of vertices 100,000
- Drawback finding all shortest paths too slow and
memory-consuming - vertices 100,000 edges 5,000,000,000
10Planar graphs-Eulerian formula
- Given G planar
- V- number of nodes
- E- number of edges
- F- number of faces
- Then Eulerian formula
- V-EF2
-
- 4-642
11Planar graphs
- Given G planar
- Then E ?? 3V-6
- ( of edges is of the same order as of
vertices, EO(V) ) - Proof Eulerian formula ? V-EF2
- In maximal planar graph each face is a triangle
(triangulation) - -each edge incident with 2 faces, we count each
edge twice ? - 3/2 F E
- 3F2E ? F2/3 E
- V-E2/3 E2 ? 1/3 E V-2 (for max.
graph) ? in any graph E ?? 3V-6
12The Set Cover Problem
- Sets Ai cover a set X if X is a union of Ai
- Weighted Set Cover Problem
- Given
- A finite set X (the ground set X)
- A family F of subsets of X, with weights w F ?
? - Find
- sets S ? F, such that
- S covers X, X ?s s ? S and
- S has the minimum total weight ? w(s) s ? S
- If w(s) 1 (unweighted), then minimum of sets
13Greedy Algorithm for SCP
1
2
6
3
4
5
- Greedy Algorithm
- While X is not empty
- find s ? F minimizing w(s) / s ? X
- X X - s
- C C s
- Return C
14Analysis of Greedy Algorithm for SCP
- Theorem APR of the Greedy Algorithm is at most
1ln k - Proof
15Analysis of Greedy Algorithm for SCP
- Theorem SCP cannot be approximated in polynomial
time for any clt1 up to c?ln k, kX - ? NP-hard to approx. SCP with approx. ratio
- (1-?) ln K for any ? gt0 ? Greedy algorithm
is the best for this problem. We will prove - Theorem Greedy
- Opt
- Let Si Si ? X
- 1/ S1? Opt/X X1X
- X2X\S1
- X3X\S1\S2
? 1 ln X
16Analysis of Greedy Algorithm for SCP
- 1/ S2? Opt/X2 ? 1/ Si ? Opt/Xi (1)
- XiXi-1-Si-1
- (1) ? Si ? Xi/Opt
- ? Xi ? Xi-1- Xi-1/Opt Xi-1(1-1/Opt)
- Xi ? Xi-1(1-1/Opt)
- Xlast ? Xlast-1 (1-1/Opt) ?
- Xi-1/ Xi ? (1-1/Opt)-1
- X1 / X2 ? (1-1/Opt)-1
- X2 / X3 ? (1-1/Opt)-1
- ?
- Xlast-1 / Xlast ? (1-1/Opt)-1
17Analysis of Greedy Algorithm for SCP
- By multiplying all these terms, we get
- X1 / Xlast ? (1-1/Opt)-(last-1) / take a
logarithm - ln X1 / Xlast ? (-last1) ln ((1-1/Opt)
- Now we use the inequality
- ln(1x) ? x
- ? ln X1 / Xlast ? (-last1)(-1/Opt)1/Opt(last-1)
yx
yln(1x)
yln x
1
18Analysis of Greedy Algorithm for SCP
- We got
- ln X / Xlast ? 1/Opt (last-1)
- lastGreedy
- Greedy-1
- Opt
?
? ln X/Xlast Xlast is at least 1