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= 

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= "— 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  V deg(v) = 2 ,  =|E| Let S=S 1 +S 0, where S 1=  v odd deg(v) S 0=  v even deg(v) S is even, S 0 is even (sum of even numbers)  S 1 is even. Since S 1 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  f 1, f 2, then e’=(f 1 ’,f 2 ’). 1 st face (cycle goes counterclockwise) 2 nd face (cycle goes clockwise)

3 Homework solution Each face is even in D(G) Each node is even in G  then each cycle is even F 1 +F 2 =F 1  F 2 \ F 1  F 2 make a “characteristic vector”: e 1 e 2... e i... e 10 (0 0 1 0) C 1 (01100100) C 2 (01001000) 1 2 1 2 2 1 2 F1F1 F2F2 Problem 1.

4 Homework solution Problem 1. F 1 (0001110001) F 2 (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.

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 A i cover a set X if X is a union of A i 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 Greedy Algorithm: –While X is not empty find s  F minimizing w(s) / |s  X| X = X - s C = C + s –Return C 6 345 2 1

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 S i =| S i  X| 1/ S 1  Opt/|X| X 1 =|X| X 2 =|X\S 1 | X 3 =|X\S 1 \S 2 |  1+ ln |X|

16 Analysis of Greedy Algorithm for SCP 1/ S 2  Opt/|X 2 |  1/ S i  Opt/|X i | (1) X i =X i-1 -S i-1 (1)  S i  X i /Opt  X i  X i-1 - X i-1 /Opt= X i-1 (1-1/Opt) X i  X i-1 (1-1/Opt) X last  X last-1 (1-1/Opt)  X i-1 / X i  (1-1/Opt) - 1 X 1 / X 2  (1-1/Opt) - 1 X 2 / X 3  (1-1/Opt) - 1  X last-1 / X last  (1-1/Opt) - 1

17 Analysis of Greedy Algorithm for SCP By multiplying all these terms, we get: X 1 / X last  (1-1/Opt) - (last-1) / take a logarithm ln X 1 / X last  (-last+1) ln ( (1-1/Opt) Now we use the inequality: ln(1+x)  x  ln X 1 / X last  (-last+1)(-1/Opt)=1/Opt(last-1) 1 y=x y=ln x y=ln(1+x)

18 Analysis of Greedy Algorithm for SCP We got: ln X / X last  1/Opt (last-1) last=|Greedy | Greedy-1 Opt  ln X/X last X last 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= "

Similar presentations


Ads by Google