# Relations

Télécharger la présentation

## Relations

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
##### Presentation Transcript

1. 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. 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. 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. 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. 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. Relational data model n-ary relation is represented with table fields R: Teaching assignments records primary key (all entries are different) Konstantin Busch - LSU

19. Selection operator: keeps all records that satisfy condition Example: Result of selection operator Konstantin Busch - LSU

20. Projection operator: Keeps only the fields of Example: Konstantin Busch - LSU

21. 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 Konstantin Busch - LSU

23. J2(R,S) 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. 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. Composition : Boolean matrix product Konstantin Busch - LSU

30. Power : Boolean matrix product Konstantin Busch - LSU

31. Digraphs (Directed Graphs) Konstantin Busch - LSU

32. 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. 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. Theorem: is the transitive Closure of is transitive Proof: Part 1: Part 2: If and is transitive Then Konstantin Busch - LSU