Presentation is loading. Please wait.

Presentation is loading. Please wait.

Homework 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)

Similar presentations


Presentation on theme: "Homework 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)"— Presentation transcript:

1 Homework 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 S=S1+S0 , 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.

2 Homework 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)

3 Homework solution Problem 1. F2 F1 Each face is even in D(G)
Each node is even in G  then each cycle is even F1+F2=F1F2 \ F1 F2 make a “characteristic vector”: e1 e2 ... ei ... e10 ( ) C1 ( ) C2 ( )

4 Homework solution Problem 1. F1 (0001110001) F2 (1111000000)
C=( ) 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.

5 Planar 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.

6 Planar 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 solutions=paths matching odd nodes

7 The T-join Problem How to delete minimum-cost set of edges from graph G to eliminate odd cycles? Construct geometric dual graph D=dual(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

8 Optimal Odd Cycle Elimination
conflict graph G dual graph D T-join odd degree nodes in D

9 T-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

10 Planar graphs-Eulerian formula
Given: G planar V- number of nodes E- number of edges F- number of faces Then: Eulerian formula V-E+F=2 4-6+4=2

11 Planar graphs Given: G planar Then: E  3V-6
(# of edges is of the same order as # of vertices, E=O(V) ) Proof: Eulerian formula  V-E+F=2 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 3F=2E  F=2/3 E V-E+2/3 E=2  1/3 E = V-2 (for max. graph)  in any graph: E  3V-6

12 The 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

13 Greedy 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

14 Analysis of Greedy Algorithm for SCP
Theorem: APR of the Greedy Algorithm is at most 1+ln k Proof:

15 Analysis of Greedy Algorithm for SCP
Theorem: SCP cannot be approximated in polynomial time for any c<1 up to cln k, k=|X|  [ NP-hard to approx. SCP with approx. ratio (1-) ln K for any  >0 ]  Greedy algorithm is the best for this problem. We will prove: Theorem: Greedy Opt Let Si=| Si  X| 1/ S1 Opt/|X| X1=|X| X2=|X\S1| X3=|X\S1\S2|  1+ ln |X|

16 Analysis of Greedy Algorithm for SCP
1/ S2 Opt/|X2|  1/ Si  Opt/|Xi| (1) Xi=Xi-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

17 Analysis 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  (-last+1) ln ((1-1/Opt) Now we use the inequality: ln(1+x)  x  ln X1 / Xlast  (-last+1)(-1/Opt)=1/Opt(last-1) y=x y=ln(1+x) y=ln x 1

18 Analysis of Greedy Algorithm for SCP
We got: ln X / Xlast  1/Opt (last-1) last=|Greedy| Greedy-1 Opt  ln X/Xlast Xlast is at least 1


Download ppt "Homework 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)"

Similar presentations


Ads by Google