homework solution problem 2. the number of odd degree vertices in a graph is even. (recom. book: g....
TRANSCRIPT
![Page 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=](https://reader036.vdocuments.us/reader036/viewer/2022082817/56649dd25503460f94ac978b/html5/thumbnails/1.jpg)
Homework solutionProblem 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=vVdeg(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.
![Page 2: 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=](https://reader036.vdocuments.us/reader036/viewer/2022082817/56649dd25503460f94ac978b/html5/thumbnails/2.jpg)
Homework solutionProblem 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 fF there is a vertex f’F’ of graph G’, for any edge eE there is an edge e’E’ (1-1 correspondence) such that if ef1, f2, then e’=(f1’,f2’).
1st face (cycle goes counterclockwise)
2nd face (cycle goes clockwise)
![Page 3: 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=](https://reader036.vdocuments.us/reader036/viewer/2022082817/56649dd25503460f94ac978b/html5/thumbnails/3.jpg)
Homework solution
Each face is even in D(G)
Each node is even in G then each cycle is even
F1+F2=F1F2 \ F1 F2 make a “characteristic vector”:
e1 e2 ... ei ... e10
(0 0 1 0) C1 (01100100)
C2 (01001000)
1 2
1 2
2
12
F1
F2
Problem 1.
![Page 4: 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=](https://reader036.vdocuments.us/reader036/viewer/2022082817/56649dd25503460f94ac978b/html5/thumbnails/4.jpg)
Homework solutionProblem 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.
![Page 5: 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=](https://reader036.vdocuments.us/reader036/viewer/2022082817/56649dd25503460f94ac978b/html5/thumbnails/5.jpg)
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.
![Page 6: 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=](https://reader036.vdocuments.us/reader036/viewer/2022082817/56649dd25503460f94ac978b/html5/thumbnails/6.jpg)
Planar bipartite graphSolution: 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
![Page 7: 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=](https://reader036.vdocuments.us/reader036/viewer/2022082817/56649dd25503460f94ac978b/html5/thumbnails/7.jpg)
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
![Page 8: 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=](https://reader036.vdocuments.us/reader036/viewer/2022082817/56649dd25503460f94ac978b/html5/thumbnails/8.jpg)
Optimal Odd Cycle Elimination
conflict graph G
dual graph D
T-join odd degree nodes in D
![Page 9: 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=](https://reader036.vdocuments.us/reader036/viewer/2022082817/56649dd25503460f94ac978b/html5/thumbnails/9.jpg)
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
![Page 10: 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=](https://reader036.vdocuments.us/reader036/viewer/2022082817/56649dd25503460f94ac978b/html5/thumbnails/10.jpg)
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
![Page 11: 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=](https://reader036.vdocuments.us/reader036/viewer/2022082817/56649dd25503460f94ac978b/html5/thumbnails/11.jpg)
Planar graphsGiven: 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=2In maximal planar graph each face is a triangle (triangulation)
-each edge incident with 2 faces, we count each edge twice 3/2 F = E3F=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
![Page 12: 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=](https://reader036.vdocuments.us/reader036/viewer/2022082817/56649dd25503460f94ac978b/html5/thumbnails/12.jpg)
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
![Page 13: 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=](https://reader036.vdocuments.us/reader036/viewer/2022082817/56649dd25503460f94ac978b/html5/thumbnails/13.jpg)
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
3 4 5
2
1
![Page 14: 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=](https://reader036.vdocuments.us/reader036/viewer/2022082817/56649dd25503460f94ac978b/html5/thumbnails/14.jpg)
Analysis of Greedy Algorithm for SCP Theorem: APR of the Greedy Algorithm is at most 1+ln k
Proof:
iii nXS ||
11 iii nkk
ii
i
k
opt
n
w
opt
kwn iii
opt
wkk
opt
wkk i
iii
ii 1111
|| 1 ii Sk
opt
wkk i
last 10
opt
w
opt
w
k
k ii
last
1ln 0xx )1ln(
opt
approx
k
k
last
0ln1
![Page 15: 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=](https://reader036.vdocuments.us/reader036/viewer/2022082817/56649dd25503460f94ac978b/html5/thumbnails/15.jpg)
Analysis of Greedy Algorithm for SCPTheorem: SCP cannot be approximated in polynomial
time for any c<1 up to cln 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|
![Page 16: 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=](https://reader036.vdocuments.us/reader036/viewer/2022082817/56649dd25503460f94ac978b/html5/thumbnails/16.jpg)
Analysis of Greedy Algorithm for SCP1/ 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
![Page 17: 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=](https://reader036.vdocuments.us/reader036/viewer/2022082817/56649dd25503460f94ac978b/html5/thumbnails/17.jpg)
Analysis of Greedy Algorithm for SCPBy 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)
1
y=x
y=ln x
y=ln(1+x)
![Page 18: 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=](https://reader036.vdocuments.us/reader036/viewer/2022082817/56649dd25503460f94ac978b/html5/thumbnails/18.jpg)
Analysis of Greedy Algorithm for SCPWe got:
ln X / Xlast 1/Opt (last-1)
last=|Greedy|Greedy-1
Opt ln X/Xlast Xlast is at least 1