461191 Discrete Math Lecture 9: Relations - PowerPoint PPT Presentation

1 / 108
About This Presentation
Title:

461191 Discrete Math Lecture 9: Relations

Description:

461191 Discrete Math Lecture 9: Relations San Ratanasanya CS, KMUTNB Adpated from Dr. Goanchanart, RSU – PowerPoint PPT presentation

Number of Views:286
Avg rating:3.0/5.0
Slides: 109
Provided by: SanR1
Category:

less

Transcript and Presenter's Notes

Title: 461191 Discrete Math Lecture 9: Relations


1
461191 Discrete MathLecture 9 Relations
  • San Ratanasanya
  • CS, KMUTNB

Adpated from Dr. Goanchanart, RSU
2
Todays topics
  • Review of Recurrence Relations
  • Administrivia
  • Relations
  • Properties of Relations
  • n-ary Relations
  • Representing Relations
  • Closures of Relations
  • Equivalence Relations
  • Partial Orderings

2
3
Recurrence Relations
  • Recurrence relation ?????? ????? an
    ??????????????? an ???????????????????????????????
    ?????????? ?????? n n0 ??? n0 ???? Nonnegative
    Integer ???????????????????????????????????
    (Solution) ??? relation ??????????
    ???????????????????????????????????????????
  • Relation ???? unique solution ????????????????????
    initial condition
  • ???????????????????????????????????????????
    Recurrence Relation ???

4
Examples
  • ??????????????????????????????? 1 ??? ??? 5 ???
    ???? recurrence relation ?????????????????????????
    ?? ??????????????????????????????????
  • ??? Pn ?????????????????????? n ???
  • P1 1, P2 1, P3 1, P4 1, P5 2
  • P6 3, P7 4, P8 5, .
  • ?????????? P6 3 2 1, P7 4 3 1, P8 5
    4 1,
  • Pn Pn-1 Pn-5

5
Solving Linear Recurrence Relations
  • ????????????????????? Recurrence relation
    ?????????????????????????? recursive ???
    ??????????????????????????????????????????????????
    ????????? n
  • ?????????????????????????? ?????????????????????
    ????????????????????????????????????????? (Linear
    equation)
  • ??????????????????????????????? 2 ?????? ???
  • Homogeneous
  • Non-Homogeneous

6
Examples
  • ????????????????????????????????? an an-1
    2an-2, a0 2, a1 7
  • ??? r2 r 2 0, r1 2, r2 -1
  • ??????? an a12n a2(-1)n
  • ????????? initial condition ?????????????????????
    a1 3 ??? a2 -1
  • ??????????? an 32n -(-1)n

7
Generating Functions
  • ????????????????? (Generating Function)
    ??????????????????????????? Power Series
  • ???????????
  • ?????????? Explicit Formula ??? Recurrence
    Relation
  • ???

8
Examples
  • ??????????????? recurrence relation ak 3ak-1
    ?????? k 1,2,3 ????? initial condition a0 2
  • ??? G(x) ???? generating function ??? ak
    ???????
  • ?????????
  • ?? G(x) ??? xG(x) ????????? recurrence relation
    ????????
  • ???? G(x) 3xG(x) (1-3x)G(x) 2 ??????? G(x)
    2/(1-3x) ???
  • ?????
  • ???????

9
Divide-and-Conquer and Recurrence Relations
  • ???????? Recursive Algorithm ???????????????? n
    ????????????????? ????? a ????????????????????????
    ??????? n/b ?????? n ???b ????????????????????????
    ????????????????????????????? g(n)
    ??????????????????????
  • ????????????????????????????????? Divide
    (???????) ?????????????????????????????
    ??????????????????????????????????????????????
    ??????????????????????????????????????????????????
    ????? ????????????????????????????????????????????
    ??????????????????????????????????????????????????
    Conquer (????????)
  • ???????? f(n) ????????????????????????????????????
    ???????? n ???????? f(n) ???????????????
    Recurrence Relation ??????
  • f(n) af(n/b) g(n)
  • ??????????????????? Divide-and-Conquer Recurrence
    Relation
  • ???????????? Master Theorem ??????????????????????
    ?????? algorithm ????????????

10
Example
  • ??? f(n) f(n/3) 1 ????? n ??? 3 ????? ??? f(1)
    1 ???? f(27)
  • f(27) f(9) 1 f(3) 2 f(1) 3 4

11
Inclusion-Exclusion
12
Example
  • ????????????????????????????????? 200 ????
    Principle of Inclusion-Exclusion
  • 40

13
Administrivia
  • Midterm Exam
  • Statistic Summary
  • n S1S2-MA 20421-2481-3 93
  • Max ??
  • Mean ??
  • Min 6
  • Standard Deviation ??
  • Homework 1-6 and Programming Assignment 1 due
    today
  • Programming Assignment 2 dues next week

Sorry, I cannot finish grading it by today
13
14
Doubts in Midterm Exam
  • 10. ??????????????????????????????????????????????
    1, 2, 3 ???????? 1 ???????? 3
  • ???????? 1 ???????? 3 ??????????? 1 ??? 3
    ?????????? ????? 1 ?????????????
  • ????? 1 ???????? 3 ????????????????? 1
    ?????????????? 3 ????? 1 ????????????????????
  • 16. ????????????????????????????
    ??????????????????????????????? 50 ???
    ????????????????????? 10 ???? ??????????? 85 ????
    ??????????????????????????????????????????????????
    ???????????????????????? ?????????????????????????
    ?????????????? 2 ??????????????????????
  • ???????? ????????????????????? 2
    ????????????????????... ?????????????????????????
    ???????? 2?
  • ????? ?????????? pigeonhole ?N/k? 2 ????? k
    ??????????????? N ???????????????????????????
    ???????? N k 1

15
Doubts in Midterm Exam
  • 18. ??????????.???????? 3 ??? ?????? 2 ??? ???
    ????? 2 ??? ?????.????????????? 1 ???? ??????
    1??? ????????????????????????????????????
  • ???????? ?????????????????????????
    ???????????????????????????????????
  • ????? ???????????????????????? r ?????????????
    ?????????????????????????????????
    ????????????????????????????????????????????
  • 19. ???????????????? CS ?????????????????????
    ????????????????????????????????????????? 40
    ??????????????????????????????? 10 ??
    ??????????????????????????????????????????????????
    ?????
  • ???????? ????????????????????????????????????
    ?????????????????????????
  • ????? ???????????????????????????????????????????
    ?????????? ?????????????????????????????????
    ????????????????????????

16
Relations
  • ????????
  • A ??????????????????
  • B ?????????????????
  • R ????????????????????? (a,b) ???????????
    ???????? a ?????????????????? b
  • ????? ?????????????????? CS01
  • (?????, CS01)
  • ??????? ?????????????????? CS02
  • (???????, CS02)
  • ???????? ?????????????????? CS01
  • (????????, CS01)

17
Relations
  • ????????
  • A ????????????????????????????
  • B ??????????????????
  • R ?????????????????????????????????????? (a,b)
    ????? a ????????? b
  • ???????????? (a,b) ????????? R

18
Relations
  • Relations (????????????) ????????????????
    ??????????????????????????? set
    ??????????????????????????????????????????????????
    ????????? ???? ??????????????????
    ??????????????????????????????????? ???????
  • Binary Relation ??????????????????????? Set 2 set
  • ????? Relation ?????????????????? Binary Relation
  • n-ary Relation ??????????????????? set ??????????
    2 set
  • Ordered Pair ?????????????????????????????????????
    ?? Set 2 set ?????????????????? ????????????
    subset ???????? Cartesian ??????? 2 set ???????
  • ??????????????? a R b ??? relation R ??? a ?? b
    ??? a R b ??????? a ??? b ????? relation R ??????
  • ??????? a R b ??????? (a,b) ?R ???? a ????????
    (related) ??? b ??? R

Definition 1 ??? A ??? B ???? Set
???????? Binary Relation ??? A ?? B ???? subset
??? A x B
Definition 2 Relation ?? Set A ??? Relation ???
A ?? A ??????????? Subset ??? A x A
/
18
19
Examples
  • A 0, 1
  • B a, b
  • A x B
  • (0,a), (0,b), (1,a), (1,b)
  • R1 (0,a), (0,b)
  • R2 (0,a), (1,a)
  • R3 (0,b), (1,a), (1,b)
  • R4 (0,a), (0,b), (1,a), (1,b)
  • ?????????????????????? relation ??? A ????? B

20
Examples
  • ??? A 0, 1, 2 ??? B a, b ???? (0,a),
    (0,b), (1,a), (2,b) ???? relation ??? A ?? B
  • ??? A 1, 2, 3, 4 ???? Ordered pair ?????????

    Relation R (a, b) a divides b
  • R (1, 1), (1, 2), (1, 3), (1, 4), (2, 2),

    (2,4), (3,
    3), (4, 4)

???????????????????? ?????????????????????????
21
Example
  • ?????????????????????????
  • R1 (a,b) a b
  • R2 (a,b) a gt b
  • R3 (a,b) a b or a -b
  • R4 (a,b) a b
  • R5 (a,b) a b 1
  • R6 (a,b) a b 3
  • ????????????????????????????????????
  • (1,1)
  • (1,2)
  • (2,1)
  • (1, -1)
  • (2,2)

22
Properties of Relations
  • R ????????????????? (Reflexive) ??? a R a
    ?????????? a ?? A
  • R ????????????????? (Symmetric) ??? a R b
    ????????? b R a
  • R ???????????????????? (Anti-symmetric) ??? a R b
    ??? b R a ????????? a b
  • R ?????????????????? (Transitive) ??? a R b ??? b
    R c ????????? a R c
  • ?? Definition 3-5 ?? section 8.1

22
23
Examples
  • Relation ?? 1,2,3,4 ?????????? ???? reflexive,
    symmetric, antisymmetric, ??? transitive ????????
    ?
  • R1 (1,1), (1,2), (2,1), (2,2), (3,4), (4,1),
    (4,4)
  • R2 (1,1), (1,2), (2,1)
  • R3 (1,1), (1,2), (1,4), (2,1), (2,2), (3,3),
    (4,1), (4,4)
  • R4 (2,1), (3,1), (3,2), (4,1), (4,2), (4,3)
  • R5 (1,1), (1,2), (1,3), (1,4), (2,2), (2,3),
    (2,4), (3,3), (3,4), (4,4)
  • R6 (3,4)
  • Reflexive R3, R5
  • Symmetric R2, R3
  • Antisymmetric R4, R5, R6
  • Transitive R4, R5, R6

23
24
More on Relations
  • ????????????????????????? Set ????????????????????
    ?? Set Operations ??? Relations ???
  • Functions ??????????????????????????? ???????
    Functions ??????? subset ??? Relations
  • Composite Relation ???? ??????????????????
    ???????????? S?R ?????????????????????????????????
    ???? a R b ??? b S c ??????? a S?R c (??
    Definition 6, Sec. 8.1)
  • Power ??? Relation (Rn) ??????????????????????????
    ??????????????????? R ????? n ?????
    ????????????????????????????? Recursive ?????????
    (?? Definition 7, Sec. 8.1)
  • R1 R, Rn1 Rn?R, n 1, 2, 3,

25
????????????????????????????????
Relation
Function
?
?
One-to-one
?
?
One-to-many
?
?
Many-to-one
26
Examples
  • ??? A 1,2,3 ??? B 1,2,3,4 ????? Relation
    R1 (1,1), (2,2), (3,3) ??? R2 (1,1),
    (1,2), (1,3), (1,4) ????
  • R1 ? R2
  • R1 ? R2
  • R1 - R2
  • R2 R1
  • ???? Composite ??? R ??? S ?????? R ???? relation
    ??? 1,2,3 ????? 1,2,3,4 ?????? R (1,1),
    (1,4), (2,3), (3,1), (3,4) ??? S ???? relation
    ??? 1,2,3,4 ????? 0,1,2 ?????? S (1,0),
    (2,0), (3,1), (3,2), (4,1)
  • S?R (1,0), (1,1), (2,1), (2,2), (3,0), (3,1)

(1,1), (1,2), (1,3), (1,4), (2,2), (3,3)
(1,1)
(2,2), (3,3)
(1,2), (1,3), (1,4)
26
27
Example
  • ??? R (1,1), (2,1), (3,2), (4,3) ???? Rn
  • R2 R?R (1,1), (2,1), (3,1), (4,2)
  • R3 R2?R (1,1), (2,1), (3,1), (4,1)
  • R4 R3?R (1,1), (2,1), (3,1), (4,1)
  • Rn R3, n 3, 4, 5,

28
???????? Relations ?? Set ??????????? n ???
  • ??? set A ???????? n ???.
  • ?????????????? set A ??? subset ??? A x A.
  • ???? A x A ????????????? n2 ???.
  • Set ??????????? m ??????? 2m subset.
  • ??????? A x A ???? subset ??????? 2n2.
  • ???????????? 2n2 relations ?? set ??????????? n
    ???.
  • Example
  • set a, b, c ???????? 232 29 512
    relations.

29
Example
  • ???? Reflexive relation ??????????? set
    ??????????? n ???
  • Reflexive ??? (a, a) ?R ?????????? Product rule
    ???? n(n-1) ordered pair
  • ??????????????? Relations ?????????? 2n(n-1) ???

30
n-ary Relations and its applications
  • ??????????????????????? set ?????????? 2 set
    ?????? ?????????????????????
  • ???? ????????. ??????????????????????? ??. ??????
    ???????????????????, ???????????????
    ???????????????????? ???????? ??????
    ?????????????????????????????? ???????
  • ??? A1, A2, , An ???? set ???? n-ary Relation ??
    set ?????????????? subset ??? A1?A2??An
    ?????? A1, A2, , An ???? Domain ??? Relation ???
    n ?????? degree (?? Definition 1, Sec. 8.2)
  • Example ??? R ???? relation ?? N?N?N ??????????
    triple (a, b, c) ?????? a lt b lt c ??????? (1, 2,
    3)?R ??? (2, 4, 3)?R ?????? Degree ?????? 3 ???
    Domain ??? N

30
31
Database and Relations
  • ??????????????????????????????????????????????????
    ??????????
  • ?????????????????????????????????????????????????
  • ??????????????????????????????????? ????????????
    ?? ????? ?????? ??????????????????????????????????
    ???????????????????????
  • ?????????????????????????????????????????????????
  • ??????????????????????????????????????????????????
    ??????????????????????????? ???? Relational Data
    Model (RDM) ??????????????? IBM ?????????????????
  • ??????????????????????????????????????????????????
    ????? Relational DataBase Management System ????
    RDBMS
  • ???????????????????????????????????????????????
    SQL ???? SEQUEL ???????????? Structured English
    Query Language
  • ????????????????????????????????????? ????
    Oracle, MS Access, mySQL ???????

32
Relational Database
  • ?????????? record (???????) ???????? n-tuples
    ??????????????? fields ???? ???????????? ????
    ??????
  • ???? ?????????. ???? record ??????????????????????
    ?????????. ???? ???? ??????? ??????. ???????? GPA
    ???????
  • ?? RDM ??????????? record ??????????????????????
    n-ary relation
  • ?????????????????????????? ????? (Table)
    ????????????????????????????????????
    ??????????????????????????? Table

33
Relational Database
??????????????????????????????????????????????
  • Primary key ??? Domain (???? Field)
    ???????????????? n-tuple ?? Table ???
  • ???????????? Domain ????????????? Primary key ???
    ????????????????????????? n-ary relation
    ??????????????????????????????????????? ??
    ???????????????????????? ???????? Table
  • Composite key ??? Cartesian product ??? Domain
    ???????????? ?????????? n-tuple ??????????
  • ???? Domain ??? Student_Name ??? Major

34
Operations on n-ary Relations
  • ????????????????????????????????? RDB
    ??????????????????????? ??????????????????????????
    ?????????????????????????????
  • ????????????????? ?????????????????????????
    Condition ??? ???????? ???????????????? n-tuple
    ??????????????? Relation ???? ???? Selection
    Operator ??????? map n-ary ?? Relation ?????
    n-tuple ????????????? Condition ???????
  • ?????????????????????????????????????? ???
    Projection ?????? map ??? n-tuple ?????? m-tuple
  • ???????????? Table ?????????????????? Join
    ???????? Table ???????????????????????????????????
    ????
  • ?? Definiton 2-4 ?? Sec 8.2

35
Operations on n-ary Relations
Definition 2 ??? R ???? n-ary Relation ??? C
???? Condition ??? Element ?? R ??????????
??????? selection operator (Sc) ??????? Map ???
n-ary Relation ?? R ????? n-ary Relation
????????????????? n-Tuple ??? R ????????????
Condition C
Definition 3 Projection Pi1i2,,im ?? Map ???
n-tuple (a1, a2, , an)????? m-tuple (a1, a2, ,
am) ?????? m ? n
Definition 4 ??? R ???? Relation ????? Degree m
??? S ???? Relation ????? Degree n ??? Join
Jp(R, S) ?????? p ? m ??? p ? n ???? Relation
????? Degree m n - p ??????????????????? (m n
p)-tuple (a1, a2, , am-p, c1, c2, , cp, b1,
b2, , bn-p) ?????? m-tuple (a1, a2, , am-p, c1,
c2, , cp) ????? R ??? n-tuple (c1, c2, , cp,
b1, b2, , bn-p) ????? S
36
Examples
  • ????????? C1 (Major Computer Science ? GPA
    gt 3.5) ???????????????? n-ary Relation ?? Table 1
    ????????????????????
  • ??? 4-tuple ??????????? (Ackermann, 231455,
    Computer Science, 3.88)
  • ?????? Projection P1,3 ??? 4-tuples (2,3,0,4),
    (Jane Doe, 234111001, Geogrpahy, 3.14), (a1, a2,
    a3, a4) ????????????????????????
  • ??? (2,0), (23411101, Geography), (a1, a3)
  • ??????????????????? Projection P1,4 ??? Table 1
    ???????
  • ??????????? Join Table 5 ??? 6 ???????????????????
    ????

37
Example
38
SQL Examples
SELECT Departure_Time FROM Flights WHERE
Destination Detroit
  • Select ?? SQL ??????? Projection
  • ????????????? Database ??? SQL ????????????? ??.
    ????? ??????????? Database

SELECT Professor, Time FROM Teaching_assignments,
Class_schedule WHERE Department Mathematics
(Rosen, 300 P.M.)
39
??????????????????? (Representing Relations)
  • ?????????????????????????????????????? ????
    Ordered pair ???????????????????????????????
  • ??????????? ????????????????????????????????????
    Zero-One Martix ??? Directed Graph
    ?????????????????????
  • ??????????? Zero-One Matrix ??????????????????????
    ?????????????????????????
  • Directed Graph ???????????????????????????????????
    ?????????????????????????????????????

39
40
Representing Relations Using Matrices
  • Relation ??????? Finite Set ?????????????????
    Zero-One Matrix ????????? R ???? Relation ??? A
    ????? B ?????? Element ?? A ???B
    ?????????????????????????? ???????????????????????
    ??? ??????? Relation R ????????????????? Matrix
    MR mij ??????
  • ??????? ??? Element ?? Matrix ??? Row ???
    Column ij ??????????? ????? ??? ai
    ????????????????? bj ?????????? R
    ?????????????????????????? ?????
  • Example ????? A 1,2,3, B 1,2 ??? R ????
    relation ??? A ?? B ?????? R (a,b) a?A ? b?B
    ? a gt b ???? Matrix ??????? R ???????? ?????? a1
    1, a2 2, a3 3, b1 1, b2 2
  • ???????? R (2,1), (3,1), (3,2) ???????

40
41
Representing Relations Using Matrices
  • Matrix ??????? Relation ?? Set ???????????????????
    ???????? Relation ?????????
  • Relation R ?? A ?????? Reflexive ?????????? mii
    1 ???????? ?????????????????????????? ??? Matrix
    ??????? R ???? ????????? 1 ??????
  • Relation R ?? A ?????? Symmetric ?????????? mij
    mji ???????? ????????? (i,j) ??? (j,i) ??? Matrix
    ??????? R ???? ?????????????????? ???? MR MRT
  • Relation R ?? A ?????? Anti-symmetric ??? mij 1
    ???? mij 0 ????? i ? j ???? ??? mij 0 ????
    mij 0 ????? i ? j

42
Representing Relations Using Matrices
  • Boolean Operation ??? Matrix ???????????????
    Union ??? Intersect ??? Relation ???
  • ?????????? ??????????? Composite of Relation
    ?????? Matrix ?????????? ????????? Boolean Product

43
Examples
  • ??? Relation R ?? Set ???????? Matrix ????????
    ??????? R???? Reflexive, Symmetric ???/????
    Antisymmetric
  • ????????? Relation R1 ??? R2 ?? Set A ????????
    Matrix ???????? ???? Matrix ??????? R1 ? R2 ???
    R1 ? R2

R ?????? Reflexive ??? Symmetric ??????????
Antisymmetric
44
Examples
  • ???? Matrix ??????? Relation SoR ????? Matrix
    ???? R??? S ???
  • ???? Matrix ??????? R2 ???????????

45
Representing Relations Using Directed Graphs
  • ????????????????????? Relation ???????????????
    ??????????? Graph ??????????? Element ??? Set
    ?????????????? ???????? Ordered Pair
    ?????????????????????????????????
    ?????????????????? ????????????????????????????
    Directed Graph ???? Digraph

Definition 1 Directed Graph ???? Digraph
???????????? Set V ??? Vertices ???? Nodes
????????? Set E ??? Ordered Pair ??? Element ??
V ??????????? Edges ???? Arcs ?????? Vertex a
?????????? Initial Vertex ??? Edge (a, b) ???
Vertex b ?????????? Terminal Vertex ??? Edge ???
Edge ???????? (a, a) ???????????????????????????
????? Vertex a ??????????????? ???? Edge
??????????? ??????????? Loop
45
46
Representing Relations Using Digraphs
  • ???????????? Directed Graph ??????????????????????
    ?????????? Relation ??? ????
  • ??? Relation ???? Reflexive ???? ???????? Loop
    ?????? Vertex ??? Directed Graph ????
  • ??? Relation ???? Symmetric ???? ??????? Edge
    ???????????????? Vertex ???????????????
    ??????????? Edge ??????????????????????????
  • ??? Relation ???? Antisymmetric ??????????? Edge
    ???(?????????) ???????? Vertex ??????????
  • ??? Relation ???? Transitive ??????????? ?????
    Edge ??? Vertex x ????? y ?????? Vertex y ????? z
    ???? ???????? Edge ??? Vertex x ????? z ????

46
47
Examples
  • ????? Directed Graph ????????????? Vertex a, b,
    c, ??? d ??? Edge (a, b), (a, d), (b, b), (b,
    d), (c, a), (c, b), ??? (d, b)
  • ???? Ordered Pair ?? Relation R ???????????
    Directed Graph ????????

48
Example
  • ??????? Relation ??????????? Directed Graph
    ?????????????????? Reflexive, Symmetric,
    Antisymmetric ???/???? Transitive

Symmetric
49
Closures of Relations
  • ????????????????? Network, ???????????????????????
    ??????????????? (Node) ???????????
    ??????????????????????????????????????? Data link
    ???????????????????? ??????????????
    ??????????????????????????????????????????????????
    ????? ???????????????????? Node
    ?????????????????????????????????????????? Node
    ???????????????? ????????????????? link
    ??????????????????????????????????????????????????
    ???????????? Relation ???????????????????????????
    ????????????????????? transitive closure ????
    ??????????????????????????

49
50
Closures of Relations
  • ?????? R???? Relation ?? Set A, Relation
    R???????????????????????????? P ????????????
    Reflexive, Symmetric ???? Transitive
    ?????????????? Relation ?????????????? P ????????
    ??? S???????????? R ?????? S ?????? Subset
    ??????? Relation ?????????????? P ????? R
    ?????????? ????????????????? S ??????? Closure
    ??? R ????????????? P

50
51
Reflexive Closure
  • ??????? Relation R (1,1), (1,2), (2,1), (3,2)
    ?? Set A 1, 2, 3 ????????? R ???????
    Reflexive ?????????? Reflexive Relation
    ??????????????????? R ?????????????????????????
  • ????? (2,2) ??? (3,3) ???? R ??????? R ????
    Reflexive
  • ???????????? Ordered pair ??? (a, a)
    ????????????????? R
  • ??????????????? Relation ????????? R ??????????
    ????????????? Reflexive Relation ??????????? R
    ?????????? ???????????????? (2,2) ??? (3,3)
  • ??????? ????????? Relation R ????? (2,2) ???
    (3,3) ?????? ???? Reflexive ???????
    ???????????????? Reflexive Relation ????? R
    ?????? ???????????????? Reflexive Closure ??? R
  • ???????? Relation R ?? Set A ??????????????
    Reflexive Closure ??? R?????????????????? ??????
    (a,a), a ?A ????????????????? R?????? R
  • ????????????????? Reflexive Closure ??? R
    ??????????? R???????? ? ??? Diagonal Relation ??
    A ??? ? (a,a) a ?A

52
Symmetric Closure
  • ??????? Relation R (1,1), (1,2), (2,2), (2,3),
    (3, 1), (3,2) ?? Set A 1, 2, 3 ????????? R
    ??????? Symmetric ?????????? Symmetric Relation
    ??????????????????? R ?????????????????????????
  • ????? (2,1) ??? (1,3) ???? R ??????? R ????
    Symmetric
  • ???????????? Ordered pair ??? (b, a) ??? (a, b) ?
    R ?????????????? R
  • ??????????????? Relation ????????????????? R
    ?????????????? Symmetric Relation ???????????? R
    ?????????? ???????????????? (2,1) ??? (1,3)
  • ??????? ????????? Relation R ????? (2,1) ???
    (1,3) ?????? ???? Symmetric ???????
    ???????????????? Symmetric Relation ????? R
    ?????? ???????????????? Symmetric Closure ??? R
  • ???????? Relation R ?? Set A ??????????????
    Symmetric Closure ??? R????????? union R ????
    Inverse ??? R ???? R-1
  • ????????????????? Symmetric Closure ??? R
    ??????????? R? R-1 ?????? R-1 (b,a) (a,b)
    ?R

53
Examples
  • ???? Reflexive Closure ??? Relation R (a,b)
    a lt b ?? set ??? Integer
  • ???? Symmetric Closure ??? Relation R (a,b)
    a gt b ?? set ??? Positive Integer

54
Transitive Closure
  • ???????? Relation R (1,3), (1,4), (2,1),
    (3,2) ?? Set A 1, 2, 3, 4 ????????? R
    ??????? Transitive ?????????? Transitive Relation
    ??????????????????? R ?????????????????????????
  • ????????????? (1,2), (2,3), (2,4) ??? (3,1) ????
    R ????????????????? R ???? Transitive ???
    ???????????????????????? (3.4)
  • ????????????????? ordered pair ????????????
    ?????????????????????????? R ???? Transitive
  • ??????????????? Transitive Closure
    ???????????????????????? Reflexive ??? Symmetric
  • ?????????? Transitive Closure????
    ??????????????????????????????????? ???? Path
    ????

55
Paths in Directed Graphs
  • ????????? Transitive Relation ???? Digraph
    ????????????????????? path ????

56
Example
  • ???????????????????????? Path ??? Directed Graph
    ????????????????????

a,b,d,e ???? Path ???????????? 3
a,e,c,d,b ??????? Path ????????? (c,d) ?????? Edge
b,a,c,b,a,a,b ???? Path ???????????? 6
d,c ???? Path ???????????? 1
c,b,a, ???? Path ???????????? 2
e,b,a,b,a,b,e ???? Path ???????????? 6
????????????? ???? 2 Path ??????? Circuit ???
b,a,c,b,a,a,b ??? e,b,a,b,a,b,e
57
Paths in Directed Graphs
  • ??????? Path ???????? Relation ???????????
    Directed Graph ??????????? ???? Path ??? a ?? b
    ?? R ????? Sequence ??? Element a, x1, x2,,
    xn-1,b ?????? (a, x1) ? R, (x1, x2) ? R, ,
    (xn-1,b) ? R ??????????? Theorem 1
  • ??????????? Path ????????????????? Transitive ???
    Relation ????????????????????????? Vertices ??
    Directed Graph ?????? Path ?????????????????

Theorem 1 ??? R ???? Relation ?? Set A ???? Path
???????????? n ?????? n ???? Positive Integer ???
a ?? b ?????????? (a,b) ? Rn
Definiton 2 ??? R???? Relation ?? Set ,
Connectivity Relation R ????????????????????
(a,b) ????? Path ????????????????????? ????? ???
a?? b ?? R
58
Transitive Closure
  • ????????? Rn ?????????????????? (a,b) ???????
    path ??????? n ??? a ?? b ????? R ???? union ???
    Rn ??????? ????
  • ??? Theorem 2 ????????? ????? Transitive Closure
    ???????? Connectivity Relation ???????
  • Example ??? R ???? Relation ?? Set
    ?????????????? ????????????????? (a,b) ??? a
    ?????? b ???? Rn ??? R ?????? n ???? positive
    integer ?????????? 1

59
Transitive Closure
  • ??????????????????? R ?????????????????????? R
    ??? path ?????????????????? ??????????????????????
    ?? path ?????????????????? R ????????? Lemma 1
  • ??????? Lemma 1 ?????
  • ??????????????? Matrix ??????? R ???
    (?????????????? Defiiniton 3 ??? Algorithm 1)
    ???????????? O(n4) (?????????????? Sec. 8.4)
  • Roy Warshall ??????? algorithm ????????????? R
    ???????????????????????????? Matrix ?????????????
    O(n3)

60
Warshalls Algorithm
61
Example
62
(No Transcript)
63
(No Transcript)
64
(No Transcript)
65
Washalls Algorithm (Cont.)
66
(No Transcript)
67
Warshalls Algorithm
68
Equivalence Relations
69
(No Transcript)
70
Equivalence Relations
71
(No Transcript)
72
(No Transcript)
73
(No Transcript)
74
(No Transcript)
75
Equivalence Class Partition
76
(No Transcript)
77
(No Transcript)
78
Partial Orderings
79
(No Transcript)
80
(No Transcript)
81
(No Transcript)
82
(No Transcript)
83
(No Transcript)
84
(No Transcript)
85
Lexicographic Ordering
86
(No Transcript)
87
(No Transcript)
88
Hasse Diagram
89
(No Transcript)
90
(No Transcript)
91
Minimal and Maximal
92
(No Transcript)
93
The Greatest/The Least Element
94
(No Transcript)
95
(No Transcript)
96
Upper Bound and Lower Bound
97
(No Transcript)
98
LUB and GLB
99
Lattice
100
(No Transcript)
101
(No Transcript)
102
(No Transcript)
103
Topological Sorting
104
(No Transcript)
105
(No Transcript)
106
(No Transcript)
107
(No Transcript)
108
Homework 8
  • Section 8.1
  • 8, 9, 13, 24, 27, 33
  • Section 8.2
  • 10, 26, 19, 28, 29
  • Section 8.3
  • 31, 32
  • Section 8.4
  • 15, 35
  • Section 8.5
  • 9, 11, 15, 16
  • Section 8.6
  • 12, 13, 40, 64, 65
  • Supplementary
  • ---

108
Write a Comment
User Comments (0)
About PowerShow.com