Part 1 Graph Theory 08 1018 1215
Part 1 Graph Theory 08 1018 1215
• Graphs
(Undirected) Graph :
2 3 5
V = {1, 2, 3, 4, 5}
(i, j) = (j, i)
1
Directed Graph (Digraph):
2 3 5
V = {1, 2, 3, 4, 5}
2
Loop : (i, i) or <i, i>
connected by an edge
K4
3
Bipartite Graph : V = X ∪ Y (X ∩ Y = φ)
to each vertex of Y
X Y
K3,4
4
Degree :
0 1
1
2 2 3 5
4
2 3
Theorem. ∑ di = 2 ⋅ |E|.
i ∈V
5
2
1
3
5 4
indegree outdegree
1 0 2
2 3 1
3 2 2
4 1 1
5 1 1
∑ di ∑ di = |E|.
in out
Theorem. =
i ∈V i ∈V
6
Subgraph : G1 = (V1, E1) is a subgraph of G = (V, E)
⇒ V1 ⊆ V and E1 ⊆ E
1 1
G1 G2
4
2
4 2
3 3
f 1 1
2 2
3 3
4 4
7
Relabel G1 according to f :
4
2
G3 G4
1 1
4 2 4 2
3 3
8
f 1 1
2 2
3 3
4 4
Relabel G3 according to f :
G4
3 1
2 4 4 2
1 3
Path:
1
2 6
3
5
4
2, 1, 3, 5, 2, 1, 6 is a walk.
9
2, 1, 3, 4, 2, 5 is a trail (all edges are distinct) of
length 5 from 2 to 5.
Connected Components :
G
C1 6 C3 8 9
2
1 C2
4
5 7
10 11
3
Connected Graphs :
10
Theorem. Let G = (V, E) be a connected graph with
Proof.
u i j
v
11
Let u, …, i, j, …, v be a path from u to v that goes
1 2
4 3
12
Theorem. There exists a strongly connected digraph of
Proof.
n n
∑ di ∑ di
in out
|E| = = ≥ n.
i=1 i=1
13
Underlying Graph :
G G’
(do Exercise # 1)
14
Spanning Trees and Connectivity
Start at vertex 1.
15
Start at vertex 1.
16
V = {1, 2, 3, …, 12}
17
• Depth First Search (DFS)
Start at vertex 1.
1→4→7→9→8→6→3→5→2
Start at vertex 1.
1→2→5→4→3
18
• Spanning Trees
19
Some breadth-first spanning trees of G :
Root : 1 8 6
20
Some depth-first spanning trees of G :
Root : 1 1 3
21
Let S(G) denote the number of spanning trees of G.
22
= 8.
23
• Minimum (Cost) Spanning Trees
A weighted graph :
24
Build a minimum spanning tree :
Kruskal’s algorithm
(1, 6), (3, 4), (2, 7), (2, 3), (4, 7), (4, 5), (5, 7),
(5, 6), (1, 2)
25
Theorem. Kruskal’s algorithm can generate a
minimum spanning tree of G.
26
Proof. Clearly, the output of Kruskal’s algorithm is a
algorithm.
* * * *
Assume e1 = e1 , e2 = e2 , …, ek−1 = ek−1 , ek ≠ ek
*
(c(ek) < c( ek )).
*
(If c(e*) < c(ek) (< c( ek )), then
*
e* = er = er for some 1 ≤ r ≤ k − 1)
27
Replace e* with ek
• Cycle Basis
28
A, B : two sets.
Define A ⊕ B = A ∪ B − A ∩ B.
B (⊕ : XOR)
Ex. {c1, c2} and {c1, c2, c4, c5} are two sets of
independent cycles.
29
Find a cycle basis of G :
not in T.
30
Lemma. The XOR of two distinct cycles is a cycle or
Theorem. Suppose
T : the set of edges in any spanning tree (or
Let c : a cycle of G;
c ∩ (E − T) = { ai1 , ai2 , …, air };
ci : the cycle created by adding ai to T.
j j
31
If it is not true, then according to the lemma
c ⊕ ( ci1 ⊕ ci2 ⊕ … ⊕ cir ) should be a cycle or
edge-disjoint cycles.
• Connectivity
Ex.
equal to n − 1.
Ex.
2-connected
33
1-connected 2-connected
spanning trees :
34
Redraw the spanning tree : ⎯⎯ tree edges
- - - - back edges
35
Vertex i : 1 4 3 11 10 9 2 6 5 7 8
DFN(i) : 1 2 3 4 5 6 7 8 9 10 11
L(i) : 1 1 1 3 3 3 1 7 9 7 7
Y Y Y
(Y : an articulation point)
36
According to the theorem, the root of a spanning tree
is an articulation point iff it has at least two children.
(b) i is not the root and has a child j with L(j) ≥ DFN(i).
if i is removed.
37
• Edge Connectivity
G − S = (V, E − S) is disconnected.
connectivity ≥ k.
Ex.
3-edge-connected
38
(i, j) is a bridge of G iff {(i, j)} is an edge cut of G.
Ex.
√ : bridges
• Finding Bridges
spanning trees :
39
Redraw the spanning tree :
Vertex i : 1 4 5 3 6 7 2 9 11 10 8
DFN(i) : 1 2 3 4 5 6 7 8 9 10 11
L(i) : 1 1 3 1 5 6 1 8 8 8 8
Y Y Y Y
(Y : a bridge)
40
Theorem. Suppose that G = (V, E) is a connected
Proof :
(do Exercise # 2)
41
Paths
once.
5, 3, 4, 5 4, 5, 2
Euler circuit : 1, 2, 4, 3, 2, 6, 5, 4, 6, 1
42
Theorem. Let G = (V, E) be a connected undirected
degrees.
(⇒) Trivial.
43
1→2→6→5→4→6→1
2→3→4→2
1→2→3→4→2→6→5→4→6→1
out
(1) u = v and diin= di for every i in V, or
out
(2) u ≠ v, diin= di for every i in V − {u, v},
duin= duout − 1, and dvin= dvout + 1.
45
A Hamiltonian cycle : 1, 2, 3, 4, …, 20, 1
A Hamiltonian path : 1, 2, 3, 4, 5
46
The problem of determining whether or not a graph
Ex.
47
Theorem. Suppose that G = (V, E) is an undirected
Combinatorics, 1977.
Ex.
48
• Shortest Paths
1, 2, 3 15
1, 2, 5, 3 14 shortest
1, 3 20
49
Dijkstra’s shortest-path algorithm:
vertex 1 chosen
vertex 2 chosen
vertex 5 chosen
vertex 3 chosen
50
vertex 4 chosen
• Transitive Closure
Adjacency matrix:
51
A(3, 4)=1 A(4, 2)=1
3 ⎯→ 4 ⎯→ 2
A2(3, 2)=1
52
A3(i, j) = 1 iff there exists an i-to-j walk of length 3.
53
Since an i-to-j walk of length ≥ |V| implies an i-to-j
(do Exercise # 3)
54
Miscellaneous Topics
• Planar Graphs
55
Theorem. Let G = (V, E) be a connected planar
|V| − |E| + r = 2.
56
remove u ⇒ (|V| − 1) − (|E| − 1) + r = 2
⇒ |V| − |E| + r = 2
⇒ |V| − |E| + r = 2
57
Part (2).
Case 1. r = 1.
Case 2. r > 1.
⇒ r ≤ |E|/(3/2) = 2|E|/3
58
Corollary. Every planar drawing of a connected
(r = 2 − |V| + |E|).
Ex. K5 has |V| = 5 and |E| = 10. Since |E| > 3|V| − 6, K5
is not planar.
59
A graph G is an elementary contraction of a graph H
incident on K.
an elementary contraction
60
Proof. Refer to : K. Wagner, “Über eine eigenschaft
590, 1965, or
61
vertices onto some edges of G3.
homeomorphic to K5 or K3,3.
• Matching
|V| = 2 × |M|.
a perfect matching.
62
Consider a bipartite graph G = (V, E), where
V = R ∪ S.
Let M be a matching in G.
{(2, 6), (3, 7), (4, 8), (5, 9)} is a complete matching.
63
Theorem. Suppose that G = (R ∪ S, E) is a bipartite
Ex.
⇒ ADJ(W) = {7}
⇒ |W| > ADJ(W)
⇒ no complete matching
64
• Cliques, Independent Sets,
Vertex Covers
65
A vertex cover in a graph is a set of vertices such that
each edge in the graph is incident with at least one
vertex in the set.
(1) V’ is a clique of G.
66
• Maximum Flow and Minimum Cut
dain = dzout = 0.
integers, satisfying
F = ψ −(a) = ψ +(z).
68
Let S ⊂ V;
S = V − S;
a ∈ S;
z ∈ S;
induced by S.
69
{<a, g>, <b, d>, <b, h>, <g, b>} is a cut set.
c(S) = c(a, g) + c(b, d) + c(b, h) = 17.
E( S ;S) = φ.
{<b, d>, <b, h>, <g, h>} is a cut set.
F = ∑ f ( x , y) − ∑ f ( y' , x') .
( x, y)∈E( S;S) ( y', x' ) ∈ E( S;S)
(Therefore, F ≤ c(S).)
Proof.
F = ∑ f (v , z) − ∑ f (z , v') . (1)
v ∈V v' ∈ V
70
According to (1) and (2),
F = ( ∑ f (v , z) − ∑ f (z , v') ) +
v ∈V v' ∈ V
∑ ( ∑ f (v , r) − ∑ f (r , v') ) , (3)
r∈S−{z} v ∈ V v' ∈V
as explained below.
counted in (4).
71
Theorem. If F = c(S), then F is maximum and c(S)
is minimum.
F’ ≤ c(S) = F ≤ c(S’)
F=8 F = 10
(augment (a, b, z) with 2)
72
F = 12 F = 13
(augment (a, d, g, z) (augment (a, b, d, g, z)
with 2) with 1)
(a, b), (d, g) and (g, z) are called forward edges, because
path P is equal to
shown below.
ΔP.
74
Theorem. F is maximum if and only if there is no
augmenting a-to-z path in N.
⇒ F = c(S)
75
Two flaws of Ford & Fulkerson’s algorithm :
76
(1) The worst-case time complexity of Ford &
Fulkerson’s algorithm is exponential.
flow.
77
Initially,
First iteration,
78
Second iteration,
Third iteration,
79
Fourth, iteration,
80
• Coloring, Chromatic Number, and
Chromatic Polynomial
Ex. χ(Kn) = n.
81
Theorem. An undirected graph G = (V, E) is bipartite
end vertices of e.
82
Theorem. P(Ge, λ) = P(G, λ) + P( Ge' , λ).
83
The constant term in P(G, λ) is 0, for otherwise
P(G, 0) ≠ 0.
(do Exercise # 4)
84