Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSC-2259 Discrete Structures

Similar presentations


Presentation on theme: "CSC-2259 Discrete Structures"— Presentation transcript:

1 CSC-2259 Discrete Structures
Relations CSC-2259 Discrete Structures Konstantin Busch - LSU

2 Relations and Their Properties
A binary relation from set to is a subset of Cartesian product Example: A relation: Konstantin Busch - LSU

3 A relation on set is a subset of
Example: A relation on set : Konstantin Busch - LSU

4 Reflexive relation on set :
Example: Konstantin Busch - LSU

5 Symmetric relation : Example: Konstantin Busch - LSU

6 Antisymmetric relation :
Example: Konstantin Busch - LSU

7 Transitive relation : Example: Konstantin Busch - LSU

8 Combining Relations Konstantin Busch - LSU

9 Composite relation: Note: Example: Konstantin Busch - LSU

10 Power of relation: Example: Konstantin Busch - LSU

11 A relation is transitive if an only if for all
Theorem: A relation is transitive if an only if for all Proof: 1. If part: 2. Only if part: use induction Konstantin Busch - LSU

12 Definition of composition:
1. If part: We will show that if then is transitive Assumption: Definition of power: Definition of composition: Therefore, is transitive Konstantin Busch - LSU

13 We will show that if is transitive then for all
2. Only if part: We will show that if is transitive then for all Proof by induction on Inductive basis: It trivially holds Konstantin Busch - LSU

14 Inductive hypothesis:
Assume that for all Konstantin Busch - LSU

15 Inductive step: We will prove Take arbitrary We will show
Konstantin Busch - LSU

16 End of Proof definition of power definition of composition
inductive hypothesis is transitive End of Proof Konstantin Busch - LSU

17 n-ary relations An n-ary relation on sets
is a subset of Cartesian product Example: A relation on All triples of numbers with Konstantin Busch - LSU

18 (all entries are different)
Relational data model n-ary relation is represented with table fields R: Teaching assignments Professor Department Course-number Cruz Zoology 335 412 Farber Psychology 501 617 Rosen Comp. Science 518 Mathematics 575 records primary key (all entries are different) Konstantin Busch - LSU

19 keeps all records that satisfy condition
Selection operator: keeps all records that satisfy condition Example: Result of selection operator Professor Department Course-number Farber Psychology 501 617 Konstantin Busch - LSU

20 Keeps only the fields of
Projection operator: Keeps only the fields of Example: Professor Department Cruz Zoology Farber Psychology Rosen Comp. Science Mathematics Konstantin Busch - LSU

21 Concatenates the records of and where the last fields of
Join operator: Concatenates the records of and where the last fields of are the same with the first fields of Konstantin Busch - LSU

22 S: Class schedule Department Course-number Room Time Comp. Science 518
2:00pm Mathematics 575 N502 3:00pm 611 4:00pm Psychology 501 A100 617 A110 11:00am Zoology 335 9:00am 412 8:00am Konstantin Busch - LSU

23 J2(R,S) Professor Department Course Number Room Time Cruz Zoology 335
9:00am 412 8:00am Farber Psychology 501 3:00pm 617 A110 11:00am Rosen Comp. Science 518 N521 2:00pm Mathematics 575 N502 Konstantin Busch - LSU

24 Representing Relations with Matrices
Relation Matrix Konstantin Busch - LSU

25 Reflexive relation on set :
Diagonal elements must be 1 Example: Konstantin Busch - LSU

26 Matrix is equal to its transpose:
Symmetric relation : Matrix is equal to its transpose: Example: For all Konstantin Busch - LSU

27 Antisymmetric relation :
Example: For all Konstantin Busch - LSU

28 Union : Intersection : Konstantin Busch - LSU

29 Boolean matrix product
Composition : Boolean matrix product Konstantin Busch - LSU

30 Boolean matrix product
Power : Boolean matrix product Konstantin Busch - LSU

31 Digraphs (Directed Graphs)
Konstantin Busch - LSU

32 there is a path of length from to in
Theorem: if and only if there is a path of length from to in Konstantin Busch - LSU

33 Connectivity relation:
if and only if there is some path (of any length) from to in Konstantin Busch - LSU

34 Theorem: Proof: if then for some Repeated node Konstantin Busch - LSU

35 Closures and Relations
Reflexive closure of : Smallest size relation that contains and is reflexive Easy to find Konstantin Busch - LSU

36 Smallest size relation that contains and is symmetric
Symmetric closure of : Smallest size relation that contains and is symmetric Easy to find Konstantin Busch - LSU

37 Transitive closure of :
Smallest size relation that contains and is transitive More difficult to find Konstantin Busch - LSU

38 is the transitive Closure of
Theorem: is the transitive Closure of is transitive Proof: Part 1: Part 2: If and is transitive Then Konstantin Busch - LSU


Download ppt "CSC-2259 Discrete Structures"

Similar presentations


Ads by Google