Upload
angelo
View
338
Download
25
Embed Size (px)
DESCRIPTION
Discrete and Combinatorial Mathematics R. P. Grimaldi , 5 th edition, 2004. Chapter 7 Graph Theory. In the beginning…. Leonhard Euler Swiss mathematician, 1707-1783. First paper in graph theory. In 1736, he wrote a solution to the problem of Königsberg bridges . - PowerPoint PPT Presentation
Citation preview
1
Discrete and Combinatorial Mathematics
R. P. Grimaldi, 5th edition, 2004
Chapter 7Graph Theory
2
In the beginning…Leonhard Euler
Swiss mathematician, 1707-1783. First paper in graph theory. In 1736, he wrote a solution to the
problem of Königsberg bridges.
Problem of the Königsberg bridges: In East Prussia Starting and ending at the same region, is it possible to cross
all seven bridges just once and return to the starting region?
Pregel river
Kneiphof island
3
Graphs A graph G = (V, E) consists
V = V(G) : set of vertices (vertex set) E = E(G) VV : set of edges (edge
set)
If E(G) is a set of ordered pairs, then G is called a directed graph; otherwise an undirected graph.
Example: V = {x, u, v, w} E = {(x,v), (x,u), (u,v), (v,w), (u,w)} x
v
u
w
x
v
u
w
4
Subgraphs If G = (V, E) is a graph, then G1 = (V1,E1) is
called a subgraph of G if V1 V and E1 E, where each edge in E1 is incident with vertices in V1.
x
v
u
w
x
v
uG G1
5
EdgesAn edge is labeled by a pair of vertices, for
instance e = (v,w). e is said to be incident with v and w. v and w are said adjacent.
isolated vertex: a vertex without incident edges. loop: an edge whose endpoints are equal. parallel edges: edges with the same endpoints.
v wisolatedvertex
loop
e
paralleledges
6
Representations of graphsAdjacency matrix
Rows and columns are labeled with ordered vertices. Aij = 1, if there is an edge between the row vertex and
the column vertex. Aij = 0 if no edge exists between them.
Incidence matrix Label rows with vertices Label columns with edges Iij = 1 if an edge is incident to a vertex, Iij = 0
otherwise.
7
Different graphs
Simple graphA graph without loops or parallel edges.
Weighted graphA graph where each edge is assigned a
numerical label or “weight”.
1
2 4
8
6
8
WalksG = (V,E) : an undirected graph,
x ,y V (not necessarily distinct)
x-y walk in G: a loop-free finite alternating sequence
of vertices and edges, where ei = (xi-1,xi). length of the walk = n. x-y walk with x = y: closed walk. Note: A walk may repeat both vertices and edges.
yxexeexexexx nnnn ,,,,,,,,,, 11322110
9
Trails, Circuits, and Paths If no edge in the x-y walk is repeated, then the
walk is called an x-y trail. A closed x-y trail is called a circuit. If no vertex of the x-y walk repeated, then the
walk is called an x-y path. A closed x-y path is called a cycle.
x
v
u
wyeveweuevextrail ,,,,,,,,,,: 62531e1
e2
e5
e3
e4
xeueveweyevexcircuit ,,,,,,,,,,,,: 432761
e6 e7
y
yewevexpath ,,,,,,: 721
xeuewevexcycle ,,,,,,,,: 4521
10
Connected graphs Let G = (V,E) be an undirected graph. We call G
connected if there is a path between any two distinct vertices of G; otherwise it is called disconnected.
Each connected subgraph of a disconnected graph G is called a component of G.
G H
11
Spanning subgraphs Given a grapg G = (V, E), let G1 = (V1,E1) be a
subgraph of G. iIf V1 = V then G1 is called a spanning subgraph of G.
x
v
u
w
x
v
uG G1
w
12
Induced subgraphs Given a grapg G = (V, E). If U V, the
subgraph induced by U, denoted by <U>, is the subgraph whose vertex set is U and which contains all edges with both endpoints in U.
x
v
u
w
x
v
uG <U>
13
Complete graphs The complete graph Kn is the simple graph
with n vertices and every pair of vertices is joined by an edge.
Example: K5
14
Complement graphs Let G be a simple graph with n vertices. The
complement of G, denoted by , is the subgraph of Kn consisting of the n vertices in G and all edges that are not in G.
Example:
G
G G
15
Bipartite graphsA simple undirected graph is called bipartite if
there exists a partition of the vertex set so that V1V2= and no edges incident with two vertices in the same subset Vk, k = 1,2.
V1
V2
16
Complete bipartite graphs
A bipartite graph G = (V,E) with vertex partition V1 and V2 , where |V1| = m and |V2| = n, is the complete bipartite graph, denoted by Km,n, if every vertex in V1 is joined to a vertex in V2 and vice versa.
V1
V2
17
Isomorphic graphs
G1 and G2 are isomorphic if there exist one-to-one onto functions f: V(G1) → V(G2) and g: E(G1) → E(G2) such that an edge e is adjacent to vertices v, w in G1 if and only if g(e) is adjacent to f(v) and f(w) in G2
aq, bv, cu, dy, er, fw, gx, ht, iz, js
18
Degree of a vertexThe degree of a vertex v, denoted by deg(v),
is the number of edges incident on v.
Example: deg(a) = 4, deg(b) = 3,
deg(c) = 2, deg(d) = 3.a b
c d
19
Sum of vertex degreesTheorem 11.2 If G = (V,E) is an undirected graph,
then
Proof. Each edge contributes exactly two counts, one count (degree) for each endpoint.
#
Corollary 11.1 For any undirected graph, the number of vertices of odd degree must be even.
Vv
Ev .||2)deg(
Vv
Ev .||2)deg(
20
Regular graphsAn undirected graph where each vertex has the
same degree is called a regular graph. If deg(v) = k for all vertices v, then the graph is called k-regular.
Hypercube Qn: n regular.010
000
001
100
111
011
110
101
21
Euler circuit
Let G = (V,E) be an undirected graph with no isolated vertices. Then G is said to have an Euler circuit if there is a circuit in G that traverses every edge of the graph exactly once.
The Königsberg bridge problem: Starting and ending at the same region, is it
possible to cross all seven bridges just once and return to the starting region?
This problem can be represented by a graph. Edges represent bridges and each vertex represents a region.
22
Euler graphsTheorems 11.3 Let G = (V,E) be an undirected
graph with no isolated vertices. Then G has an Euler circuit if and only if G is connected and all its vertices have even degree.
Therefore, the Konigsberg bridge problem has no solution.
23
Proof(1)() Trivial.() Step 1. Start from an arbitrary
vertex, go through an unused edge whenever it exists, and terminate at a vertex whose incident edges are all used.
1
5
6
4
2
3 1265461
24
Proof(2)
Step 2. Remove used edges and repeat step 1. for the remaining graph (start from a visited vertex).
1
5
6
4
2
3 2342
25
Proof(3)
Step 3. Augment the path obtained so far with the result of step 2.
1234265461
Step 4. Repeat step 2 and step 3 until all the edges are used. #
26
Planar graphsA graph G is planar if it can be drawn in the plane
with its edges intersecting only at vertices of G; otherwise it is nonplanar.
ab
c d
a planar graph a nonplanar graph
27
Elementary subdivisionLet G = (V,E) be a loop-free undirected graph,
where E. An elementary subdivision of G results when an edge e = (u,w) is removed from G and then the edges (u,v), (v,w) are added to G-e, where vV.
v
wu
28
Homeomorphic graphsThe loop-free undirected graphs G1 and G2 are
called homeomorphic if they are isomorphic or if they can both be obtained from the same loop-free undirected graph H by a sequence of elementary subdivisions.
29
Kuratowski’s TheoremA graph is nonplanar if and only if it contain a
subgraph that is homeomorphic to either K5 or K3,3.
Peterson graph
a
b
cd
ef
g
hi
j
j a d
bfe
c
g
h
i
30
Euler’s Theorem
Theorem 11.6 Let G = (V,E) be a connected planar graph with |V| =v and |E| = e. Let r be the number of regions in the plane determined by a planar embedding. Then v – e + r = 2.
Proof. By induction.
v = 4e = 6r = 4 v – e + r = 2.
R1
R2
R3
R4
31
Variant of Euler’s TheoremCorollary 11.3 Let G = (V,E) be a loop-free connected planar
graph with |V| =v and |E| = e > 2, and r regions. Then 3r 2e and e 3v - 6.
Proof. For each region R, the degree of R, denoted by deg(R), is the number of edges traversed in a closed walk about the boundary of R.
Each region has at least three edges.
Each region has degree 3.
The sum of the degrees of the r regions is 2e.
2e 3r. e 3v – 6. (By Euler’s Theorem) #
32
Hamilton’s toyWilliam Rowan Hamilton
Irish mathematician, 1805-1865 In 1859, he developed a game sold to a Dublin toy
manufacturer. The object of the game was to find a cycle containing all vertices.
33
Hamilton paths and cyclesIf G = (V,E) is a graph with |V| 3, we say that G has a Hamilton
cycle if there is a cycle in G that contains every vertex in V.
Theorem 11.8 Let G = (V,E) be a loop-free graph with |v| = n 2. If deg(x) + deg(y) n – 1 for all x, y V, x y, then G has a Hamilton path.
A Hamilton path is a path in G that contains each vertex.
Theorem 11.9 Let G = (V,E) be a loop-free graph with |v| = n 3. If deg(x) + deg(y) n – 1 for all nonadjacent x, y
V, then G has a Hamilton cycle.
34
Gray code
A Gray code is a sequence s1, s2,…, such that every n-bit string appears somewhere in the
sequence sk and sk+1 differ in exactly one bit
and s1 differ in exactly one bit.
000001011010110111101 100
ns2
ns2
35
A Hamiltonian cycle on the hypercube
010000
001
100
111
011
110
101
36
Trees and ForestsLet G = (V,E) be a loop-free undirected graph.
The graph G is called tree if G is connected and contains no cycles.
G is called forest if G contains no cycles and is not connected.
treeforest
37
Properties of TreesTheorem 12.1 If a, b are distinct vertices in a tree
T = (V,E), then there is a unique path that connects a and b.
Proof. By contradiction.
Theorem 12.3 In any tree T = (V,E), |V| = |E| + 1.
Proof. By Mathematical Induction on |E|.
38
Properties of Trees (cont.)Theorem 12.4 For every tree T = (V,E), if |V| 2, then T
has at least 2 vertices of degree 1.
Proof. From Theorem 12.3 on
Theorem 12.5 The following statements are equivalent for a loop-free undirected graph G = (V,E).
(a) G is a tree.
(b) G is connected, but the removal of any edge from G disconnects G into two subgraphs that are trees.
(c) G contains no cycles, and |V| = |E| + 1.
(d) G is connected, and |V| = |E| + 1.
Vv
Ev .||2)deg(
39
Brainstorm將 1~9數字填入九個圓圈中,相鄰的數字(有邊連結)之差不能小於 3 。數字不能重複,題目已經預填兩個數。
8
6
40
Brainstorm根據已故的麻省理工 ( MIT )哲學及邏輯家 George Boolos,
以下的趣味邏輯問題可算是全世界最難的一個。有甲、乙、丙三位精靈,其中一位只說真話,另外一位只說假
話,還有一位隨機地決定何時說真話,何時說假話。你可以向這三位精靈發問三個是非題,而你的任務是從他們的答案找出誰說真話,誰說假話,誰是隨機答話。你每次可選擇任何一位精靈問話,問的問題可以取決於上一題的答案。這個難題困難的地方是這些精靈會以「 Da」或「 Ja」回答,但你並不知道它們的意思,只知道其中一個字代表「對」,另外一個字代表「錯」。你應該問那三個問題呢?
答案見 Boolos (1998) Logic, Logic, and Logic Harvard University Press, 弟 29章 .