Title: Graph Theory
1Graph Theory
2Simple Graphs
- ??????????????????????????????????????????????????
??????????????????????????????????????????????????
???????? ???????????????????????????????????????
????????????? ??????????????????? ???????????????
??? - ??????????????????????????????(simple graph)
??????????????? ??????????????????????????(symm
etric), - ????????????(irreflexive)
- ????????????? G(V,E)??????????
- ?????????(vertices)??????? V
- ??????????(edges)??????? E ?????????????????????
?????????? u,v ? V
Visual Representationof a Simple Graph
2
Department of Computer Science, Burapha University
3Multigraphs
- ????????????????????? ????????????????????????????
??????????????????? - ????????????(multigraph) G(V, E, f )
??????????????????? V ,?????????? E
????????????fE?u,vu,v?V ? u?v - ???????? ???? ???????????
- ?????????????????????????????????
???? e1 ??? e2 ??????????????????(multiple)????
parallel ??? f(e1)f(e2)
Paralleledges
3
Department of Computer Science, Burapha University
4Pseudographs
- ???????????????????? ?????????????????????????????
??????? (R ????????????????????) - ?????????(pseudograph) G(V, E, f )
??????fE?u,vu,v?V ???? e?E ??????? - ??? f(e)u,uu
- ???????? ???? ?????? ?????????????
- ???????????????????????????????
- ???????????????????????????
4
Department of Computer Science, Burapha University
5Directed Graphs
- ???????????????????????? R ???????????????????????
???? - ???????????????(directed graph) (V,E)
??????????????????? V ????????????????????? E
????? V - ???????? ???? V ?????????????,E(x,y) x
??? y
5
Department of Computer Science, Burapha University
6Directed Multigraphs
- ???????????????????? ?????????????????????????????
??????????????????????????????????? - ???????????????????????(directed multigraph)
G(V, E, f ) ??????????????????? V ?????????? E
???????????? fE?V?V - ???????? ????., V???????,E???????????? WWW
?????????? ???????????????????????
6
Department of Computer Science, Burapha University
7Types of Graphs Summary
7
Department of Computer Science, Burapha University
8Graph Terminology
- ??? G ????????????????????????????????????????? E
??? e?E ?????? u,v ??????? ?????????????? - u, v ?????????(adjacent) ?????????????????(neighbo
rs) ????????????(connected) - ???? e ?????????????????(incident)
????????????????? u ?????? v - ???? e ??????(connects) u ??? v ??????
- ??? u ?????? v ???????????(endpoints) ??????? e
8
Department of Computer Science, Burapha University
9Example
Edge incidentwith b,d
e
g
a
b
d
f
AdjacentVertices
c
9
Department of Computer Science, Burapha University
10Degree of a Vertex
- ??? G ?????????????????????, ??? v?V
- ?????(degree) ??? v ???????????? deg(v),
?????????????????????(incident)??????????
(?????????????????????????????????) - ????????????????? 0 ???????? ??????(isolated)
- ????????????????? 1 ???????? pendant
10
Department of Computer Science, Burapha University
11Graph Terminology
- Example ?????????????????????????????? ?????????
pendant ????????????????????????
?????????????????????????????????
Solution ??? f ????????????? ?????? a, d ??? j
???? pendant ???????????????????????????? g ????
deg(g) 5 ???????????????????
?????????(pseudograph) (??????????? ???????????)
11
Department of Computer Science, Burapha University
12Graph Terminology
- ???????????????????????????? ?????????????????????
???????????????????????????????????????????????
Result ??????????? 9 ???? ????????????????????
18 ?????????????????? ????????????????????????????
??????? ??????????????????????????????????????????
????????
12
Department of Computer Science, Burapha University
13Handshaking Theorem
- ??? G ????????????????????? ????????????? V
????????????? E ??????? - Corollary ?????????????????????
???????????????????????????????????? - ???????? ???? ???????????????? 10 ???
??????????????? 6 ??????????????????????????? - ??? ????????????????????????????????? 6?10 60
??? Handshaking Theorem ???????? 2e 60 ???????
?????????????????? 30 ????
13
Department of Computer Science, Burapha University
14Directed Degree
- ??? G ???????????????????, v ????????????? G
- ?????????(in-degree) ??? v, deg?(v),
??????????????????????????? v - ????????(out-degree) ??? v, deg?(v),
?????????????????????????? v - ?????(degree) ??? v, deg(v)?deg?(v)deg?(v),
?????????????????????????????????? v - Directed Handshaking Theorem ??? G
????????????????????????????????????? V
????????????????? E ???????
14
Department of Computer Science, Burapha University
15Directed Degree
- Example ?????????????????????????????? a, b, c,
d ??????????????
deg-(b) 4 deg(b) 2
deg-(a) 1 deg(a) 2
deg-(d) 2 deg(d) 1
deg-(c) 0 deg(c) 2
15
Department of Computer Science, Burapha University
16Special Graph Structures
- ????????????????????????????????
- Complete graphs Kn
- Cycles Cn
- Wheels Wn
- n-Cubes Qn
- Bipartite graphs
- Complete bipartite graphs Km,n
16
Department of Computer Science, Burapha University
17Complete Graphs
- ????????????????? n?N, ???????????(complete
graph) ????? n ???, Kn, ????????????????????? n
??? ???????????????????????????????????? ?u,v?V
u?v?u,v?E
K1
K4
K3
K2
K5
K6
????????? Kn ?? ????
17
Department of Computer Science, Burapha University
18Cycles
- ?????????????? n?3, ???????????????(cycle)????? n
???, Cn, ???????????????????? Vv1,v2, ,vn ???
Ev1,v2,v2,v3,,vn?1,vn,vn,v1
C3
C4
C5
C6
C8
C7
??????????????????????????? Cn?
18
Department of Computer Science, Burapha University
19Wheels
- ?????????????? n?3, ?????(wheel) Wn,
????????????????????????????????? Cn
?????????????? vhub ?????????? n ???? vhub,v1,
vhub,v2,,vhub,vn
W3
W4
W5
W6
W8
W7
??????????????????????????? Wn?
19
Department of Computer Science, Burapha University
20Bipartite Graphs
- ????? ???? G(V,E) ???????????????(bipartite)
?????????? V V1 ? V2 ?????? V1nV2? ??? ?e?E
?v1?V1,v2?V2 ev1,v2 - ?????????????????????????????????
- ????????????????????????????????????????????????
- ????????????????????????????????????????????????
V2
V1
20
Department of Computer Science, Burapha University
21Bipartite Graphs
- Example I ???? C3 ???????????????(bipartite)?????
???
No, ?????????????????????????????
??????????????????????????????????????????????????
?????
Example II ???? C6 ???????????????(bipartite)????
????
Yes, ???????????????????? C6 ?????????????????????
????????
22Complete Bipartite Graphs
- ?????? m,n?N, ??????????????????(complete
bipartite graph) Km,n ?????????????????? V1
m, V2 n, ??? E v1,v2v1?V1 ? v2?V2 - ????????? m ???????????????? ???
- n ??????????????? ???
- ???????????????????????????????
- ???????????????????????
K4,3
Km,n ?? _____ ?????? _____ ????
23Subgraphs
- ????????(subgraph) ??????? G(V,E) ???????
H(W,F) ?????? W?V ??? F?E
K5
??????????? K5
24Graph Unions
- ??????(union) G1?G2 ???????????????? G1(V1, E1)
??? G2(V2,E2) ???????????????? (V1?V2, E1?E2)
?
25Graph Representations Isomorphism
- ??????????(Graph representations)
- Adjacency lists
- Adjacency matrices
- Incidence matrices
- ?????????????????(Graph isomorphism)
- ?????????????????????(isomorphic) ??????????
?????????????????????????????????????
???????????????????????????????
25
Department of Computer Science, Burapha University
26Adjacency Lists
- ?????????? 1 ?????????????? ??????????????????????
?????????????????
b
a
d
c
e
f
26
Department of Computer Science, Burapha University
27Adjacency Lists
27
Department of Computer Science, Burapha University
28Adjacency Matrices
- ???????? Aaij, ?????? aij ???? 1 ??? vi, vj
??????????????? G, ??????? 0 ?????????????????????
???????? - ?????????????????? ???????????????????????????????
1 ???????????????????????????????????????? 1 ????
28
Department of Computer Science, Burapha University
29Adjacency Matrices
c
d
e
a
b
- ????????? ??????????????(Adjacency matrices)
????????????????????? ????????????????????????
29
Department of Computer Science, Burapha University
3030
Department of Computer Science, Burapha University
31Incidence Matrices
- ????? ??? G (V, E) ??????????????????????
?????? V n ????????????????????????? G ??????
v1, v2, , vn ??? e1, e2, , em - ??????????????(incidence matrix) ??? G
???????????????????????????????
?????????????????????? 0-1 ???? n?m ???????? 1
?????????? (i, j) ????????? ej ????????? vi, ???
0 ?????????????????????????? - ??????????????? ?????????????? M mij,
- mij 1 ????????? ej ???????????? vi mij
0 ???????????? ej ???????????? vi
32Incidence Matrices
e1 e2 e3 e4 e5 e6
a b c d e
e1
e6
e3
e5
e2
e4
33Incidence Matrices
- Example ????????????????????? M ??????? G
???????????????? a, b, c, d ??????? 1, 2, 3, 4,
5, 6?
Solution
- ????????? ???????????????????????????????????
?????????????????? 1?????? ???????????????????????
??????????????????????? ??????????????????????????
????????? 1 ?????????????
34Connectivity
- ????(path)???????????? n ?????? u ???????? v
????????????????????????????????? u ???????? v - ????????????????????????????????(circuit) ??? uv
- ???????????????????????????????
?????????????(connected) ??????????
??????????????????????????????????????????????????
?
34
Department of Computer Science, Burapha University
35Euler Hamilton Paths
- ????????????(Euler circuit) ?????? G
???????????????????????????????????????????? G - ???????????????(Euler path) ?????? G
??????????(????)??????????????????????????????????
??? G - ????????????(Hamilton circuit) ???????????????????
????????????????? G ?????????????????????????? - ???????????????(Hamilton path) ??????????(????)???
?????????????????????????? G ?????????????????????
?????
36Euler circuit Euler path
- ??????? ????????????(Euler path) ??????
??????????????????????????????????????????????????
- ??????? ???????????? (Euler circuit) ?????? ???
?????????????????????????????????????????? - ??????????????????????????????????? ????????????
(Eulerian graph) - ???????? ???? G1 ??????????????( Euler path) a,
c, d, e, b, d, a, b
a
b
c
d
e
36
Department of Computer Science, Burapha University
37Example
- abcdefgehia ???????? ??????????????????????
??????????????????????????????? bd, hd, hc ??? ci - ??????????????? G ???????????????? ?????????????
G ????????????????? - abicbdchdefgehia
37
Department of Computer Science, Burapha University
38Bridges of Königsberg Problem
- ????????????????????????????????(A,B,C,D)
???????????????????????????????????????????
?????????????????????????????????????????
A
D
B
C
????????????
???????????????????????????
39Euler Path Theorems
- Theorem ????????????????????????(connected
multigraph) ???????????????? ??????????
?????????????????????? - Theorem ????????????????????????
??????????????????? (????????????????????)
????????????????????????? 2 ??????????????????????
?????? - ??????????????????????, ??????????????????????????
? - ?????????????????????????????(Euler Circuit
Algorithm) - ?????????????????
- ???????????????????????????????
??????????????????????????????????????????? - ??????????????????????????
- ??????????????????????????????????????????????
40Hamilton circuitHamilton path
- ???????????? (Hamilton path) ???????
???????????????????????????????
?????????????????????????????????????? - ???????????? (Hamilton circuit) ??????? ???
?????????????????????????????????
?????????????????????????????????????? - ???????????? (Hamiltonian graph) ???
????????????????????????
40
Department of Computer Science, Burapha University
41Hamiltonian Graph
????????????????????????????????????????????
42Hamilton path
- ??? G ?????????????????????????????????
- ???? G ????????????????? abcde ???????????????????
????????????? G ????????????????? ??????????? de
2 ????? ?????????????????????????????? G
????????????????? ??????? G ???????????????????
42
Department of Computer Science, Burapha University
43Hamilton circuit
- ??? G ????????????????????????????????? (?)
????????????????????????????????????????????????
(?) ?????????????????????? ???????? G
????????????????
43
Department of Computer Science, Burapha University
44Round-the-World Puzzle
- ?????????????(traverse) ??????????????????????????
? 12 ??????????????????????????????????????????
?????????? 12 ????
?????????????????? 12 ????
45Hamilton Paths
- ???????????????????? ?????????????????????????????
??????? ??????????????????????????? ????
?????????????????????????? ???????????????????????
???????????????? ?????????????????????????????????
?(????)????????
46Hamiltonian Path Theorems
- Diracs theorem ??????? G ??????????????????????
???????(connected, simple)????????????? n?3 ???,
??????????v deg(v)?n/2, ???????? G ?????????????? - Ores corollary ??????? G ???????????????????????
?????? ????????????? n3 ??? ??? deg(u)deg(v)n
????????????? ???u,v ???????????????????????? ,
???? ???? G ??????????????
46
Department of Computer Science, Burapha University
47????????
- ????????????? G ?????????????????????????
????????????????
?????? ????????????? G ??????????????????????? 5
?????????????????????????????? ??????????? 3 ????
3 5/2 ??????? G ?????????????????? ????????????
????? G ????????????????
48Planar Graph
- ??????? ??????????? G ??? ????????????? (planar
graph) ????????????????????????????????? G
????????????????????????????????????????????? - ??????????????????????????????????????????????????
????????????????
48
49Example
- ????????? 3 ???? ??? ???????????3 ????
???????????????????????????????????????????????
???????? ?????? 3 ???? ???????????????????????????
????????????? 3 ???? ?????? ??? ????? ???????????
???????????????????????????????? ????????
???????????????? ?????????????????????????????????
????????????? ????????????????????????????????????
????????????
49
50Graph Coloring
- ????????????(graph coloring) ????????????????????
??????? ??????????????????????????????????????????
????????????????? ????????????? - Chromatic number ?????????????????????????????????
????????????????????? - ???? C5 ??????? Chromatic number ???? 3
- ???? C4 ,C6 ??????? Chromatic number ???? 2
- ???? ???? Cycle Cn ??????? Chromatic number ????
3 ????? n ???????????? ?????????? Chromatic
number ???? 2 ????? n ????????????
C6
C5
C4
50
51Example
- ????????????????????? Kn ???????????????????? n
?? ???????????????????????? K m, n ?????
Chromatic number??? 2
51
52The 4-color theorem
- Chromatic number ?????????(planar graph) 4
- The Four color theorem chromatic number
????????????????????????????????? 4 - Example ???? G1 ?? chromatic number 3, ???? G2
?? chromatic number 4
G1
G2
52
53Application of Graph Coloring
- ????????????????????????????
- ??????????????????????????????????????????????????
?????????????????????? - ???????????? ?????????????????????????????????????
???????????????????????? 2 ???????????????????????
??? - ???????????????????????????????????????????????
53
54Example
- ???????????????????????????????????????????????
???????????????????????????????????? 7 ????
(????????????????? 1, 2,,7) ?????????????????????
???????????????????????? ?????????????????????????
?????????????????????????????????? - 1-2, 1-3, 1-4, 1-7
- 2-3,2-4,2-5,2-7
- 3-4,3-6,3-7
- 4-5,4-6
- 5-6,5-7
- 6-7
54