Basic Graph Theory

advertisement
Preliminaries
 Graphs
G = (V, E),
V : set of vertices
E : set of edges (arcs)
(Undirected) Graph :
1
3
2
4
V = {1, 2, 3, 4, 5}
E = {(1, 3), (3, 2), (2, 4)}
(i, j) = (j, i)
1
5
Directed Graph (Digraph):
1
3
2
4
V = {1, 2, 3, 4, 5}
E = {<1, 3>, <3, 2>, <2, 4>}
<i, j>  <j, i>
(arcs)
Multigraph : E is a multiset of edges
2
5
Loop : (i, i) or <i, i>
Simple Graph : no loops and no two edges connecting
the same pair of vertices
Complete Graph :
each pair of distinct vertices is
connected by an edge
K4
Kn : the complete graph with n vertices
3
Bipartite Graph : V = X  Y (X  Y = )
(i, j) (or <i, j>) : i  X, j  Y or i  Y, j  X
Complete Bipartite Graph : each vertex of X is connected
to each vertex of Y
X
Y
K3,4
Km,n : a complete bipartite graph with |X|=m and |Y|=n
4
Degree :
0
1
1
2
3
2
4
2
3
Let di be the degree of vertex i.
Theorem.
 d i = 2  |E|.
i ∈V
5
5
2
1
3
5
4
indegree
outdegree
0
3
2
1
1
2
1
2
1
1
1
2
3
4
5
Let di in and di out denote the indegree and outdegree of
vertex i.
Theorem.
in
 di
i ∈V
=
out
 di = |E|.
i ∈V
6
Subgraph : G1 = (V1, E1) is a subgraph of G = (V, E)
 V1  V and E1  E
Isomorphism : G1 = (V1, E1) and G2 = (V2, E2) are
isomorphic iff there exists a one-to-one
and onto mapping f such that (i, j)  E1
iff (f(i), f(j))  E2.
1
1
G1
G2
4
2
4
2
3
3
f
1
2
3
4
1
2
3
4
G1 and G2 are isomorphic.
7
Relabel G1 according to f :
3
4
2
1
1
4
2
3
G3
G4
1
4
1
2
4
3
2
3
G3 and G4 are isomorphic.
8
f
1
2
3
4
1
2
3
4
Relabel G3 according to f :
G4
1
3
2
2
4
4
3
1
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.
2, 1, 3, 4, 6 is a path (all vertices are distinct) of
length 4 from 2 to 6.
3, 4, 2, 1, 3 is a cycle (all vertices are distinct) of
length 4.
(circuit : all edges are distinct)
Connected Components :
G
C1
6
C3
2
8
9
10
11
C2
1
4
5
7
3
G consists of three connected components.
Connected Graphs :
G is a connected graph iff it consists of one single
connected component.
10
Theorem. Let G = (V, E) be a connected graph with
|V|  1. G contains either a vertex of degree 1 or a
cycle (or both).
Proof. Consider that every vertex in G has degree 1.
If we travel G from an arbitrary vertex, then a cycle
will be formed after going through at most |V| vertices.
Theorem. Let G = (V, E) be a connected graph that
contains at least one cycle. Let (i, j)  E be an edge
that is on at least one cycle of G. The graph H = (V,
E{(i, j)}) is also connected.
Proof.
k
u
i
j
11
v
Let u, …, i, j, …, v be a path from u to v that goes
through the edge (i, j). There exists another path
u, …, i, …, k, …, j, …, v from u to v that does not go
through (i, j).
Theorem. There exists a connected undirected graph
of n vertices that contains exactly n  1 edges, where n
 1. Also, every n-vertex connected undirected graph
contains at least n  1 edges.
A digraph is strongly connected iff it contains directed
paths both from i to j and from j to i for every pair of
distinct vertices i and j.
2
1
4
3
a strongly connected digraph
12
Theorem. There exists a strongly connected digraph of
n vertices that contains exactly n arcs, where n  2. Also,
every n-vertex strongly connected digraph contains at
least n arcs.
Proof.
The definition of strongly connected digraphs assures
di in  1 and di out  1 for every vertex i. Hence,
n
|E| =
 di
i=1
n
in
=
 di
out
i=1
13
 n.
Underlying Graph :
G’
G
G’ is the underlying graph of G
(do Exercise # 1)
14
Spanning Trees and Connectivity
 Breadth First Search (BFS)
Start at vertex 1.
{1}  {2, 3, 4}  {5, 6, 7}  {8, 9}
Vertex 10 is not reachable from vertex 1.
15
Start at vertex 1.
{1}  {2, 3, 4}  {5}
Vertices 6, 7, 8 are not reachable from vertex 1.
BFS can be used to determine the connected components
of an undirected graph.
16
V = {1, 2, 3, …, 12}
Step 1. Perform BFS starting at an arbitrary vertex
(assume vertex 5).
{5, 6, 7} is reachable from vertex 5.
{5, 6, 7} is a connected component.
Step 2. Repeat Step 1 for an arbitrary vertex (assume
vertex 1) from the remaining vertices.
{1, 2, 3, 4} is a connected component.
Step 3. Repeat Step 1 for an arbitrary vertex from
the remaining vertices.
{8, 9, 10, 11, 12} is a connected component.
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
DFS can be also used to determine the connected
components of an undirected graph.
18
 Spanning Trees
Let G = (V, E) be an undirected graph.
A subgraph G1 = (V1, E1) of G is a spanning tree of G
iff V1 = V and G1 is a tree.
BFS and DFS can define spanning trees, named
breadth-first spanning trees and depth-first spanning
trees, respectively.
19
Some breadth-first spanning trees of G :
Root :
1
8
20
6
Some depth-first spanning trees of G :
Root :
1
1
3
 Number of Spanning Trees
An edge e of G is said to be contracted if it is deleted
and its both ends are identified; the resulting graph
is denoted by Ge.
21
Let S(G) denote the number of spanning trees of G.
S(G) = S(G  e) + S(G  e) for any edge e of G.
S(G  e) : number of spanning trees that do not
contain e.
S(G  e) : number of spanning trees containing e.
22
=
8.
23
 Minimum (Cost) Spanning Trees
A weighted graph :
cost = 110
cost = 129
24
Build a minimum spanning tree :
Kruskal’s algorithm
Step 1. Sort edges nondecreasingly according to their costs.
(1, 6), (3, 4), (2, 7), (2, 3), (4, 7), (4, 5), (5, 7),
(5, 6), (1, 2)
Step 2. Examine the sorted sequence of edges sequentially.
An edge is selected if inclusion of it does not cause a
cycle.
25
Theorem. Kruskal’s algorithm can generate a
minimum spanning tree of G.
26
Proof. Clearly, the output of Kruskal’s algorithm is a
spanning tree of G. First, we assume that all edge
costs are distinct.
T : the spanning tree of G generated by Kruskal’s
algorithm.
T* : a minimum spanning tree of G.
Suppose that T contains e1, e2, …, en1 and
*
*
*
T* contains e1 , e 2 , …, e n1 , both in increasing
order of costs, where n is the number of vertices.
*
*
*
*
Assume e1 = e1 , e2 = e 2 , …, ek1 = e k 1 , ek  e k
*
(c(ek) < c( e k )).
Insert ek into T* : a cycle is formed, in which there is
one edge, denoted by e*, that is not
in T and c(e*) > c(ek).
*
(If c(e*)  c(ek) (< c( e k )), then
*
e* = e r = er for some 1  r  k  1)
27
Replace e* with ek

form a spanning tree with less cost than T*,
a contradiction
If distinct edges may have the same cost, then
*
c(ek) = c( e k ) (and c(e*) = c(ek)) is possible.
For such a situation, replace e* with ek in T*, form a
new minimum spanning tree T** (having the same cost
as T*), and repeat the above process on T** .
Finally, either there is a contradiction or T = T**.
 Cycle Basis
28
A, B : two sets.
Define A  B = A  B  A  B.
( : XOR)
Ex. c1 = {e1, e6, e7}, c2 = {e2, e7, e8}
 c1  c2 = {e1, e2, e6, e8} = c3
S = {c1, c2, …, ck} is a set of independent cycles iff no
cycle ci in S is the XOR of some other cycles in S.
Ex. {c1, c2} and {c1, c2, c4, c5} are two sets of
independent cycles.
A set S of independent cycles forms a cycle basis for a
graph G iff every cycle of G is the XOR of some cycles
in S.
Ex.
{c1, c2, c4, c5} forms a cycle basis, where
c1 = {e1, e6, e7}, c2 = {e2, e7, e8},
c4 = {e4, e5, e9} and c5 = {e3, e8, e9}.
29
Find a cycle basis of G :
Step 1. Find a spanning tree T of G.
Step 2. Create cycles by adding edges of G that are
not in T.
30
Lemma. The XOR of two distinct cycles is a cycle or
a union of edge-disjoint cycles.
Proof : Refer to : Introduction to Combinatorial
Mathematics, proof of Theorem 7-9, by Liu.
Theorem. Suppose
T : the set of edges in any spanning tree (or
forest) of G = (V, E);
E  T : {a1, a2, …, ak};
ci : the unique cycle created by adding ai to T.
Then, {c1, c2, …, ck} is a cycle basis of G.
Proof : Each ci contains ai that is not in other cycles
 {c1, c2, …, ck} is a set of independent cycles.
Let c : a cycle of G;
c  (E  T) = { ai1 , ai2 , …, air };
ci : the cycle created by adding ai to T.
j
j
Then, c = ci1  ci2  …  cir .
31
If it is not true, then according to the lemma
c  ( ci1  ci2  …  cir ) should be a cycle or
edge-disjoint cycles.
There is a contradiction, because all the edges in
c  ( ci1  ci2  …  cir ) are contained in T.
 Connectivity
Let G = (V, E) be a connected undirected graph.
A subset S of V is called a vertex cut of G iff G  S =
(V  S, E  {(i, j) | i  S or j S, (i, j)  E}) is disconnected.
Ex.
{2, 6} is a vertex cut. {1, 2} is not a vertex cut.
32
A k-vertex cut is a vertex cut of k vertices.
The (vertex) connectivity of G is defined to be the
minimum k for which G has a k-vertex cut.
The connectivity of Kn, which has no vertex cut, is
equal to n  1.
G is said to be k-connected if its connectivity  k.
Ex.
2-connected
33
1-connected
2-connected
Vertex 2 is called an articulation point.
v  V is an articulation point of G iff {v} is a vertex cut.
A connected graph G is biconnected (2-connected) iff
G contains no articulation points.
 Finding Articulation Points
A graph and one (rooted at ) of its depth-first
spanning trees :
34
Redraw the spanning tree :

tree edges
----
back edges
DFN (Depth First Number) : the visiting sequence of
vertices by DFS
L(i) : the least DFN reachable from i through a path
consisting of zero or more (downward) tree
edges followed by zero or one back edge.
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
Y
7
7
Y Y
(Y : an articulation point)
An edge (i, j) of G is a cross edge with respect to
a spanning tree of G iff i is neither an ancestor
nor a descendent of j.
Theorem. Suppose that G = (V, E) is a connected
graph and T is a depth-first spanning tree of G.
Then, G contains no cross edge with respect to T.
Proof. (i, j)  T  (i, j) is not a cross edge.
Hence, consider (i, j)  T.
Assume DFN(i)  DFN(j).
 j belongs to the subtree of i
 (i, j) is not a cross edge.
36
According to the theorem, the root of a spanning tree
is an articulation point iff it has at least two children.
Theorem. Suppose that G = (V, E) is a connected
graph and T is a depth-first spanning tree of G.
Then, i  V is an articulation point of G iff either
(a) i is the root of T and has at least two children, or
(b) i is not the root and has a child j with L(j)  DFN(i).
Proof. We only prove (b).
j and its descendents will become isolated
if i is removed.
37
 Edge Connectivity
Given G = (V, E), a subset S of E is an edge cut of G iff
G  S = (V, E  S) is disconnected.
A k-edge cut is an edge cut of k edges.
The edge connectivity of G is defined to be the
minimum k for which G has a k-edge cut.
G is said to be k-edge-connected if its edge
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
A graph and one (rooted at ) of its depth-first
spanning trees :
39
Redraw the spanning tree :
Vertex i :
1
4
5
3
6
7 2
9 11 10
DFN(i) :
1
2
3
4
5
6 7
8
9
L(i) :
1
1
3
1
5
6 1
8
8
Y
Y Y
(Y : a bridge)
40
Y
8
10 11
8
8
Theorem. Suppose that G = (V, E) is a connected
graph and T is a depth-first spanning tree of G.
Let (i, j)  E, and assume DFN(i)  DFN(j).
Then, (i, j) is a bridge of G iff L(j) = DFN(j).
Proof :
If L(j) = DFN(j), then T’ will be isolated from G after
removing (i, j).
(do Exercise # 2)
41
Paths
 Euler Trails, Euler Circuits
A trail (circuit) is called an Euler trail (Euler circuit)
of G = (V, E) iff it traverses each edge of G exactly
once.
Euler trail : 1, 2, 3, 1,
Euler trail : 1, 2, 3, 5, 3,
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
graph. Assume |V|  1. Then,
(1) G has an Euler trail iff it contains either zero or
exactly two vertices with odd degrees;
(2) G has an Euler circuit iff all vertices have even
degrees.
Sketch of the proof.
() Trivial.
() An Euler trail is constructed as follows (an Euler
circuit is constructed similarly).
Step 1. Start from an odd-degree vertex (or any vertex
if no odd-degree vertex exists), traverse an
untraversed edge whenever it exists, and
finally terminate at a vertex whose incident
edges were all traversed.
43
1265461
Step 2. Remove traversed edges and repeat Step 1 for
the remaining graph.
2342
Step 3. Augment the trail obtained thus far with the
circuit obtained by Step 2.
1234265461
Step 4. Repeat Step 2 and Step 3 until all the edges
were traversed.
44
Theorem. Suppose that G = (V, E) is a directed graph
and |V| > 1. Let diin and diout denote the indegree and
outdegree of vertex i, respectively. Then, G contains a
u-to-v Euler trail iff the underlying graph of G is
connected and either
(1) u = v and diin = diout for every i in V, or
(2) u  v, diin = diout for every i in V  {u, v},
duin = duout  1, and dvin = dvout + 1.
Proof. Left as an exercise.
 Hamiltonian Paths, Hamiltonian
Cycles
A path (cycle) is called a Hamiltonian path (cycle) of
G = (V, E) iff it goes through each vertex (exclusive of
the starting vertex and ending vertex) of G exactly
once.
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
contains a Hamiltonian path (or cycle) is known to be
NP-complete.
There exist some sufficient (but not necessary)
conditions for an undirected graph having a
Hamiltonian path or cycle.
Theorem. Suppose that G = (V, E) is an undirected
graph and |V| = n  2. Let di be the degree of vertex vi.
If di + dj  n  1 for all vi, vj  V and vi  vj, then G has a
Hamiltonian path.
Proof. Refer to “Supplement of Graph Theory”.
Ex.
There exists a Hamiltonian path.
47
Theorem. Suppose that G = (V, E) is an undirected
graph and |V| = n  3. If for every 1  i  (n  1)/2, G
has fewer than i vertices with degrees at most i, then
G contains a Hamiltonian cycle. When n is odd, G
contains a Hamiltonian cycle, even if G has (n  1)/2
vertices of degrees (n  1)/2.
Proof : Refer to : R. Brualdi, Introductory
Combinatorics, 1977.
Ex.
There exists a Hamiltonian cycle.
48
 Shortest Paths
1-to-3 paths
costs
1, 2, 3
15
1, 2, 5, 3
14
1, 3
20
shortest
49
Dijkstra’s shortest-path algorithm:
(choose the vertex with the minimum cost,
repeatedly, until all vertices are chosen)
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
3

A(4, 2)=1

4
2
A2(3, 2)=1
A2(i, j) = 1 iff there exists an i-to-j walk of length 2.
52
A3(i, j) = 1 iff there exists an i-to-j walk of length 3.
A4(i, j) = 1 iff there exists an i-to-j walk of length 4.
The transitive closure of A is

A+ =

i=1
Ai.
A+(i, j) = 1 iff there exists an i-to-j walk of length  1.
53
Since an i-to-j walk of length  |V| implies an i-to-j
walk of length  |V|  1,
The reflexive transitive closure of A is

A* =

i 0
Ai = A0 + A1 + A2 + A3 + A4
A*(i, j) = 1 iff there exists an i-to-j walk of length  0.
(do Exercise # 3)
54
Miscellaneous Topics
 Planar Graphs
There are many ways to draw a graph.
A graph is planar iff it can be drawn so that no two
edges cross. When a planar graph is drawn so that
no two edges cross (i.e., planar drawing), the plane
is partitioned into regions.
55
Theorem. Let G = (V, E) be a connected planar
graph. Consider any planar drawing of G. Let r
be the number of regions. The following hold.
(1) |V|  |E| + r = 2.
(2) |E|  3|V|  6, if |E|  2.
Proof. Part (1). By induction on |E|.
Induction base. When |E| = 1, |V| = 2 and r = 1,
|V|  |E| + r = 2.
Induction hypothesis. Assume |V|  |E| + r = 2 for
|E| = m  1.
Induction step. Consider |E| = m + 1.
Case 1. G contains a vertex u with degree 1.
56
remove u 

(|V|  1)  (|E|  1) + r = 2
|V|  |E| + r = 2
Case 2. G contains no vertex of degree 1.
remove (u, v) 

|V|  (|E|  1) + (r  1) = 2
|V|  |E| + r = 2
57
Part (2).
Case 1. r = 1.
|E| = |V|  1 (G is a tree)
(1)
|E|  2
(2)

(1) and (2)
|V|  3

|E|  3|V|  6
Case 2. r  1.

every region is bounded by at least 3 edges

every edge is shared by at most 2 regions
 every region “consumes” at least 3/2 edges
 r  |E|/(3/2) = 2|E|/3
|V|  |E| + r = 2

|V|  |E| + 2|E|/3  2

|E|  3|V|  6
58
Corollary. Every planar drawing of a connected
planar graph has the same number of regions
(r = 2  |V| + |E|).
Corollary. Suppose that G = (V, E) is a planar graph
with k connected components, and r is the number of
regions in any planar drawing of G. Then, |V|  |E| + r
= k + 1.
Ex. K5 has |V| = 5 and |E| = 10. Since |E|  3|V|  6, K5
is not planar.
Ex. K3,3 satisfies |E|  3|V|  6, but it is not planar.
59
A graph G is an elementary contraction of a graph H
iff G can be obtained from H by replacing two adjacent
vertices i and j of H by a single vertex K. All edges
incident on either i or j (but not both) in H are now
incident on K.
an elementary contraction
A graph H is contractible to the graph G iff G can be
obtained from H by a series of elementary contractions.
Theorem. A graph G is planar iff it does not contain a
subgraph that is contractible to K3,3 or K5.
60
Proof. Refer to : K. Wagner, “Über eine eigenschaft
der ebenen komplexe,” Math. Ann., vol. 114, pp. 570590, 1965, or
J. A. Bondy and U. S. R. Murty, Graph Theory with
Applications, pp. 156, 1976.
Two graphs are said to be homeomorphic if they can
be obtained from the same graph by adding vertices
onto some of its edges, or one can be obtained from
the other by the same way.
G1 and G2 are homeomorpic because they can be
obtained from G3 by adding vertices onto some of the
edges of G3. G1 and G3 (G2 and G3) are homeomorphic
because G1 (G2) can be obtained from G3 by adding
vertices onto some edges of G3.
61
Theorem. A graph G is planar iff no subgraph of G is
homeomorphic to K5 or K3,3.
Proof. Refer to : N. Deo, Graph Theory with
Applications to Engineering and Computer Science,
1974, or F. Harary, Graph Theory, 1972.
 Matching
M  E is a matching in G = (V, E) if no two edges in
M are incident on the same vertex. Moreover, M is
a maximum matching if there exists no matching M’
with |M’|  |M| in G, and M is a perfect matching if
|V| = 2  |M|.
{(1, 6), (2, 3), (4, 5)} is a
maximum matching and
a perfect matching.
62
Consider a bipartite graph G = (V, E), where
V = R  S.
Let M be a matching in G.
|M|  min{|S|, |R|}.
M is a complete matching iff |M| = min{|S|, |R|}.
{(2, 6), (3, 7), (4, 8), (5, 9)} is a complete matching.
63
Theorem. Suppose that G = (R  S, E) is a bipartite
graph, where |R|  |S| is assumed. For any W  R, let
ADJ(W) = { v | v is adjacent to a vertex in W}. Then,
G has a complete matching iff |W|  |ADJ(W)| for any
subset W of R.
Ex.
Let W = {3, 4}.
 ADJ(W) = {7}
 |W|  ADJ(W)
 no complete matching
64
 Cliques, Independent Sets,
Vertex Covers
A clique in a graph is a set of vertices every two of
which are adjacent.
V’ = {1, 2, 3} is a clique of size 3.
An independent set in a graph is a set of vertices no
two of which are adjacent.
V’ = {1, 2, 3} is an independent set of size 3.
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.
V  V’ = {4, 5} is a vertex cover of size 2.
Theorem. Suppose that G = (V, E) is an undirected
graph and V’  V. The following statements are
equivalent.
(1) V’ is a clique of G.
(2) V’ is an independent set of G .
(3) V  V’ is a vertex cover of G .
Proof. (1)  (2)  (3).
66
 Maximum Flow and Minimum Cut
Transport network N = (V, E)
(1) Weighted, connected, directed.
(2) A pair of source node a and sink node z.
(3) A nonnegative capacity c(e) for each e  E.
da in = dzout = 0.
A flow is a function f from E to the set of nonnegative
integers, satisfying
capacity constraints: 0  f(e)  c(e) for each e  E, and
conservation constraints:  +(v) =  (v) for v  {a, z},
where  +(v) ( (v)) is the total flow into (out of) v.
67
An edge e is saturated if f(e) = c(e), and unsaturated else.
The total flow (or net flow) of f is defined to be
F =  (a) =  +(z).
The maximum flow problem is to determine f so that
F is maximum.
f is not a flow, because  +(g) = 5  4 =  (g).
f is a flow, but F = 8 is not maximum.
F is bounded by min{c(a, b) + c(a, g), c(d, z) + c(h, z)} = 11.
68
Let
S  V;
S = V  S;
a  S;
zS ;
E(S; S ) be the set of edges from S to S ;
E( S ;S) be the set of edges from S to S.
E(S; S )  E( S ;S) is called a cut (or a-z cut) of N.
Define c(S) =

eE ( S ;S )
c( e ) to be the capacity of the cut
induced by S.
(1) S = {a, b}, S = {d, g, h, z}.
E(S; S ) = {<a, g>, <b, d>, <b, h>}.
E( S ;S) = {<g, b>}.
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.
(2) S = {a, b, g}, S = {d, h, z}.
E(S; S ) = {<b, d>, <b, h>, <g, h>}.
E( S ;S) = .
{<b, d>, <b, h>, <g, h>} is a cut set.
c(S) = c(b, d) + c(b, h) + c(g, h) = 15.
E(S; S )  E( S ;S) is a minimum cut if c(S) is minimum.
Lemma. (Conservation of Flow)
F =

( x , y )  E ( S ;S )
f ( x , y) 

( y' , x' )  E ( S ;S )
f ( y' , x' ) .
(Therefore, F  c(S).)
Proof.
F =

v V
f (v , z) 

v'  V
f ( z , v' ) .
(1)
For any r  S  {z},
 +(r) =  f ( v , r ) =  f ( r , v' ) =  (r).
v V
v'  V
70
(2)
According to (1) and (2),
F = (

f (v , z) 

(
v V

r S { z } v  V

v'  V
f ( z , v' ) ) +
f (v , r ) 

v'  V
f ( r , v' ) ) ,
(3)
which can be rewritten as
F =

( x , y )  E ( S ;S )
f ( x , y) 

( y' , x' )  E ( S ;S )
f ( y' , x' ) ,
(4)
as explained below.
Consider each edge (x, y)  E.
 x  S, y  S 
f(x, y) is not counted in (3), (4).
 x S, y S 
f(x, y) is counted twice, positively
and negatively, in (3), but not
counted in (4).
 x  S, y  S 
f(x, y) is counted once, positively,
in (3), (4).
 x S, yS 
f(x, y) is counted once, negatively,
in (3), (4).
71
Theorem. If F = c(S), then F is maximum and c(S)
is minimum.
Proof. According to the lemma above,
F’  c(S) = F  c(S’)
for any total flow F’ and any (a ) S’  V, which means
that F is maximum and c(S) is minimum.
Theorem. F = c(S) if and only if
(a) f(e) = c(e) for each e  E(S; S );
(b) f(e) = 0 for each e  E( S ;S).
Proof. A consequence of Conservation of Flow (P. 70).
Ford & Fulkerson’s algorithm :
F=8
F = 10
(augment (a, b, z) with 2)
72
F = 12
(augment (a, d, g, z)
with 2)
F = 13
(augment (a, b, d, g, z)
with 1)
Consider the path (a, b, d, g, z) again.
(a, b), (d, g) and (g, z) are called forward edges, because
they have the same direction as the flow; (b, d) is called
a backward edge, because it has the opposite direction to
the flow.
A path in N is called an augmenting path, if its each
forward edge is unsaturated and its each backward
edge e has f(e) > 0.
The maximal increment of flow by an augmenting a-to-z
path P is equal to
P = min{ min{c(e)  f(e) | e is a forward edge},
min{f(e) | e is a backward edge} }.
73
The correctness of Ford & Fulkerson’s algorithm is
shown below.
Theorem. Suppose that f is a flow of N and P is an
augmenting a-to-z path. Define f + as follows:
f +(e) =
f(e) + P, if e is a forward edge;
f(e)  P, if e is a backward edge;
f(e),
if e is not an edge of P.
Then, f + is also a flow of N. The total flow increases by
P .
Proof. Clearly, capacity constraints hold for all e  E.
Conservation constraints also hold for all v  V  {a, z}.
74
Theorem. F is maximum if and only if there is no
augmenting a-to-z path in N.
Proof. () trivial.
() To find an S so that F = c(S) is maximum, with
the following illustrative network.
S = {v | there is an augmenting a-to-v path in N}.
S = {a, b, d, g}. ( S contains z.)

f(e) = c(e) if e  E(S; S ), and f(e) = 0 if e  E( S ;S)

F = c(S)
75
Two flaws of Ford & Fulkerson’s algorithm :
Select (a, b, z) and (a, d, z) as augmenting paths.
Select (a, d, b, z) and (a, b, d, z), in the sequence, as
augmenting paths.
76
(1) The worst-case time complexity of Ford &
Fulkerson’s algorithm is exponential.
(2) The capacities must be rational numbers. If they
are irrational numbers, then Ford & Fulkerson’s
algorithm may cause an infinite sequence of flow
augmentations, and the flow finally converges to
a value that is one fourth of the maximum total
flow.
Edmonds & Karp’s algorithm :
 Use BFS to find shortest augmenting paths
iteratively. (A forward edge is selected only
if it is unsaturated, and a backward edge e
is selected only if f(e) > 0.)
 If no further augmenting path is available, a
maximum flow is obtained.
Edmonds & Karp’s algorithm can overcome the two
flaws of Ford & Fulkerson’s algorithm.
77
Initially,
First iteration,
78
Second iteration,
Third iteration,
79
Fourth, iteration,
No further augmenting path can be found.
F* = 8 and S* = {a, b, d, j, k}.
80
 Coloring, Chromatic Number, and
Chromatic Polynomial
A proper coloring of a graph G is an assignment of
colors to the vertices of G so that no two adjacent
vertices are assigned with the same color.
The chromatic number of G, denoted by (G), is the
smallest number of colors needed to properly color G.
A graph is k-colorable iff it can be properly colored
with k colors.
Ex. (Kn) = n.
Ex. The following graph G is 3-colorable. Since it
contains a K3, it has (G)  3. Therefore, (G) = 3.
81
Theorem. An undirected graph G = (V, E) is bipartite
iff G contains no cycle of odd length.
Define P(G, ) to be the number of different ways to
properly color G with at most  distinct colors.
Considering  a variable, P(G, ) is a polynomial
function, called the chromatic polynomial of G.
The value of P(G, ) is equal to the number of functions
f: V  {1, 2, …, } so that f(u)  f(v) if (u, v)  E.
Ex. P(Kn, ) = 0 as  < n.
When   n, P(Kn, ) = (  1)(  2) … (  n + 1).
Ex. If G is a path on n vertices, then P(G, ) = (  1)n1.
Ge : the graph obtained by deleting an edge e of G.
Ge' : the graph obtained from G by identifying the two
end vertices of e.
82
Theorem. P(Ge, ) = P(G, ) + P( Ge' , ).
(or P(G, ) = P(Ge, )  P( Ge' , ).)
Ex. Compute P(G, ) for G being a cycle of length 4.
P(Ge, ) = (  1)3; P( Ge' , ) = (  1)(  2).
P(G, ) = (  1)3  (  1)(  2)
= 4  43 + 62  3.
P(G, 1) = 0, P(G, 2) = 2  (G) = 2.
83
The constant term in P(G, ) is 0, for otherwise
P(G, 0)  0.
When |E| > 0, the sum of the coefficients in P(G, ) is 0,
for otherwise P(G, 1)  0.
(do Exercise # 4)
84
Download