1 / 11

CMSC 203 / 0201 Fall 2002

CMSC 203 / 0201 Fall 2002. Week #12 – 11/13/15 November 2002 Prof. Marie desJardins Guest lecturer/proctor: Prof. Dennis Frey. MON 11/11 RELATIONS (6.1-6.2). Concepts/Vocabulary. Binary relation R  A x B (also written “a R b” or R(a,b)) Relations on a set: R  A x A

Download Presentation

CMSC 203 / 0201 Fall 2002

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CMSC 203 / 0201Fall 2002 Week #12 – 11/13/15 November 2002 Prof. Marie desJardins Guest lecturer/proctor: Prof. Dennis Frey

  2. MON 11/11 RELATIONS (6.1-6.2)

  3. Concepts/Vocabulary • Binary relation R  A x B (also written “a R b” or R(a,b)) • Relations on a set: R  A x A • Properties of relations • Reflexivity: (a, a)  R • Symmetry: (a, b)  R  (b, a)  R • Antisymmetry: (a, b)  R  a=b • Transitivity: (a, b)  R  (b, c)  R  (a, c)  R • Composite relation: • (a, c)  SR  bB: (a, b)R  (b, c) S • Powers of a relation: R1 = R, Rn+1 = Rn  R • Inverse relation: (b,a)  R-1  (a,b)  R • Complementary relation: (a,b) R  (a,b)  R

  4. Concepts/Vocabulary II • n-ary relation: R  A1 x A2 x … x An • Ai are the domain of R; n is its degree (or arity) • In a database, the n-tuples in a relation are called records; the entries in each record (i.e., elements of the ith set in that n-tuple) are the fields • In a database, a primary key is a domain (set Ai) whose value completely determines which n-tuple (record) is indicated – i.e., there is only one n-tuple for a given value of that domain • A composite key is the Cartesian product of a set of domains whose values completely determine which n-tuple is indicated • Projection: delete certain fields in every record • Join: merge (union) two relations using common fields

  5. Examples • Exercise 6.1.4: Determine whether the relation R on the set of all people is reflexive, symmetric, antisymmetric, and/or transitive, where (a,b)  R iff • (a) a is taller than b • (b) a and b were born on the same day • (c) a has the same first name as b • (d) a and b have a common grandparent

  6. Examples II • Exercise 6.1.21: Let R be the relation on the set of people consisting of pairs (a, b) where a is a parent of b. Let S be the relation on the set of people consisting of pairs (a, b) where a and b are siblings (brothers or sisters). What are S  R and R  S? • Exercise 5.1.29: Show that the relation R on a set A is symmetric iff R = R-1. • Exercise 5.1.33: Let R be a relation that is reflexive and transitive. Prove that Rn = R for all positive integers n.

  7. WED 11/13RELATIONS II (6.3-6.4)

  8. Concepts / Vocabulary • Zero-one matrix representation of [binary] relations • Matrix interpretations of properties of relations on a set: reflexivity, symmetry, antisymmetry, and transitivity • Digraph representation of [binary] relations • Pictorial interpretations of properties of relations on a set • Closure of R with respect to property P • smallest relation containing R that satisfies P • Transitive closure, reflexive closure, … • Path analogy for transitive closures; connectivity relation R*; Algorithm 6.4.1 for computing transitive closure (briefly); Warshall’s algorithm (briefly)

  9. Examples • Exercise 6.3.5: How can the matrix for R be found from the matrix representing R, a relation on a finite set A? • Exercise 6.3.15: List the ordered pairs in the relations represented by the directed graphs: b a d c

  10. Exercise 6.3.18 (partial): Given the digraphs representing two relations, how can the directed graphs of the union and difference of these relations be found? • Exercise 6.4.8: How can the directed graph representing the symmetric closure of a relation on a finite set be constructed from the directed graph for this relation? • Exercise 6.4.23: Suppose that the relation R is symmetric. Show that R* is symmetric.

  11. FRI 11/8MIDTERM #2 Good luck! 

More Related