Download presentation
Presentation is loading. Please wait.
1
CSE 311 Foundations of Computing I Lecture 19 Relations Autumn 2011 CSE 3111
2
Announcements Reading assignments – 7 th Edition, Section 9.1 and pp. 594-601 – 6 th Edition, Section 8.1 and pp. 541-548 – 5 th Edition, Section 7.1 and pp. 493-500 Upcoming topics – Relations – Finite State Machines Autumn 2011CSE 3112
3
Definition of Relations Let A and B be sets, A binary relation from A to B is a subset of A B Let A be a set, A binary relation on A is a subset of A A
4
Relation Examples R 1 = {(a, 1), (a, 2), (b, 1), (b, 3), (c, 3)} R 2 = {(x, y) | x ≡ y (mod 5) } R 3 = {(c 1, c 2 ) | c 1 is a prerequisite of c 2 } R 4 = {(s, c) | student s had taken course c } Autumn 2011CSE 3114
5
Properties of Relations Let R be a relation on A R is reflexive iff (a,a) R for every a A R is symmetric iff (a,b) R implies (b, a) R R is antisymmetric iff (a,b) R and a b implies (b,a) R R is transitive iff (a,b) R and (b, c) R implies (a, c) R /
6
Combining Relations Let R be a relation from A to B Let S be a relation from B to C The composite of R and S, S R is the relation from A to C defined S R = {(a, c) | b such that (a,b) R and (b,c) S}
7
Examples (a,b) Parent: b is a parent of a (a,b) Sister: b is a sister of a What is Sister Parent? What is Parent Sister? S R = {(a, c) | b such that (a,b) R and (b,c) S}
8
Examples Using the relations: Parent, Child, Brother, Sister, Sibling, Father, Mother, Husband, Wife express - Uncle: b is an uncle of a Cousin: b is a cousin of a
9
Powers of a Relation R 2 = R R = {(a, c) | b such that (a,b) R and (b,c) R} R 0 = {(a,a) | a A} R 1 = R R n+1 = R n R
10
How is Anderson related to Bernoulli?
12
Autumn 2011CSE 31112 http://genealogy.math.ndsu.nodak.edu/
13
BauerCaratheodoryMinkowski Klein LipschitzDirichletFourier LagrangeEuler Johann BernoulliJacob BernoulliLeibniz RheticusCopernicus Anderson Weigel Mayr
14
Beame CookQuineWhiteheadHopkins SedgewickSmith NewtonBarrowGalileo
15
Nicolaus Copernicus Georg Rheticus Moritz Steinmetz Christoph Meurer Philipp Muller Erhard Weigel Gottfried Leibniz Noclas Malebranache Jacob Bernoulli Johann Bernoulli Leonhard Euler Joseph Lagrange Jean-Baptiste Fourier Gustav Dirichlet Rudolf Lipschitz Felix Klein C. L. Ferdinand Lindemann Herman Minkowski Constantin Caratheodory Georg Aumann Friedrich Bauer Manfred Paul Ernst Mayr Richard Anderson Galileo Galilei Vincenzo Viviani Issac Barrow Isaac Newton Roger Cotes Robert Smith Walter Taylor Stephen Whisson Thomas Postlethwaite Thomas Jones Adam Sedgewick William Hopkins Edward Routh Alfred North Whitehead Willard Quine Hao Wang Stephen Cook Paul Beame
16
n-ary relations Let A 1, A 2, …, A n be sets. An n-ary relation on these sets is a subset of A 1 A 2 ... A n.
17
Relational databases Student_NameID_NumberMajorGPA Knuth328012098CS4.00 Von Neuman481080220CS3.78 Von Neuman481080220Mathematics3.78 Russell238082388Philosophy3.85 Einstein238001920Physics2.11 Newton1727017Mathematics3.61 Karp348882811CS3.98 Newton1727017Physics3.61 Bernoulli2921938Mathematics3.21 Bernoulli2921939Mathematics3.54
18
Alternate Approach Student_IDNameGPA 328012098Knuth4.00 481080220Von Neuman3.78 238082388Russell3.85 238001920Einstein2.11 1727017Newton3.61 348882811Karp3.98 2921938Bernoulli3.21 2921939Bernoulli3.54 Student_IDMajor 328012098CS 481080220CS 481080220Mathematics 238082388Philosophy 238001920Physics 1727017Mathematics 348882811CS 1727017Physics 2921938Mathematics 2921939Mathematics
19
Database Operations Projection Join Select
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.