390 likes | 935 Vues
Relations. CSC-2259 Discrete Structures. Relations and Their Properties. A binary relation from set to is a subset of Cartesian product. Example:. A relation:. A relation on set is a subset of. Example:. A relation on set :.
E N D
Relations CSC-2259 Discrete Structures Konstantin Busch - LSU
Relations and Their Properties A binary relation from set to is a subset of Cartesian product Example: A relation: Konstantin Busch - LSU
A relation on set is a subset of Example: A relation on set : Konstantin Busch - LSU
Reflexive relation on set : Example: Konstantin Busch - LSU
Symmetric relation : Example: Konstantin Busch - LSU
Antisymmetric relation : Example: Konstantin Busch - LSU
Transitive relation : Example: Konstantin Busch - LSU
Combining Relations Konstantin Busch - LSU
Composite relation: Note: Example: Konstantin Busch - LSU
Power of relation: Example: Konstantin Busch - LSU
Theorem: A relation is transitive if an only if for all Proof: 1. If part: 2. Only if part: use induction Konstantin Busch - LSU
1. If part: We will show that if then is transitive Assumption: Definition of power: Definition of composition: Therefore, is transitive Konstantin Busch - LSU
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
Inductive hypothesis: Assume that for all Konstantin Busch - LSU
Inductive step: We will prove Take arbitrary We will show Konstantin Busch - LSU
definition of power definition of composition inductive hypothesis is transitive End of Proof Konstantin Busch - LSU
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
Relational data model n-ary relation is represented with table fields R: Teaching assignments records primary key (all entries are different) Konstantin Busch - LSU
Selection operator: keeps all records that satisfy condition Example: Result of selection operator Konstantin Busch - LSU
Projection operator: Keeps only the fields of Example: Konstantin Busch - LSU
Join operator: Concatenates the records of and where the last fields of are the same with the first fields of Konstantin Busch - LSU
S: Class schedule Konstantin Busch - LSU
J2(R,S) Konstantin Busch - LSU
Representing Relations with Matrices Relation Matrix Konstantin Busch - LSU
Reflexive relation on set : Diagonal elements must be 1 Example: Konstantin Busch - LSU
Symmetric relation : Matrix is equal to its transpose: Example: For all Konstantin Busch - LSU
Antisymmetric relation : Example: For all Konstantin Busch - LSU
Union : Intersection : Konstantin Busch - LSU
Composition : Boolean matrix product Konstantin Busch - LSU
Power : Boolean matrix product Konstantin Busch - LSU
Digraphs (Directed Graphs) Konstantin Busch - LSU
Theorem: if and only if there is a path of length from to in Konstantin Busch - LSU
Connectivity relation: if and only if there is some path (of any length) from to in Konstantin Busch - LSU
Theorem: Proof: if then for some Repeated node Konstantin Busch - LSU
Closures and Relations Reflexive closure of : Smallest size relation that contains and is reflexive Easy to find Konstantin Busch - LSU
Symmetric closure of : Smallest size relation that contains and is symmetric Easy to find Konstantin Busch - LSU
Transitive closure of : Smallest size relation that contains and is transitive More difficult to find Konstantin Busch - LSU
Theorem: is the transitive Closure of is transitive Proof: Part 1: Part 2: If and is transitive Then Konstantin Busch - LSU