Relations. Important Definitions We covered all of these definitions on the board on Monday, November 7 th. Definition 1 Definition 2 Definition 3 Definition.

Slides:



Advertisements
Similar presentations
Representing Relations
Advertisements

CSE 211- Discrete Structures
Representing Relations Rosen 7.3. Using Matrices For finite sets we can use zero-one matrices. Elements of each set A and B must be listed in some particular.
CSE115/ENGR160 Discrete Mathematics 04/26/12 Ming-Hsuan Yang UC Merced 1.
8.3 Representing Relations Connection Matrices Let R be a relation from A = {a 1, a 2,..., a m } to B = {b 1, b 2,..., b n }. Definition: A n m  n connection.
5/16/20151 You Never Escape Your… Relations. 5/16/20152Relations If we want to describe a relationship between elements of two sets A and B, we can use.
CS2210(22C:19) Discrete Structures Relations Spring 2015 Sukumar Ghosh.
Module #1 - Logic 1 Based on Rosen, Discrete Mathematics & Its Applications. Prepared by (c) , Michael P. Frank and Modified By Mingwu Chen Relations.
Relations Chapter 9.
Chapter 9 1. Chapter Summary Relations and Their Properties n-ary Relations and Their Applications (not currently included in overheads) Representing.
Applied Discrete Mathematics Week 10: Equivalence Relations
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2007 Chapter 8: Relations Relations(8.1) n-any Relations &
Chapter Relations and Their Properties 8.2 n-ary Relations and Their Applications 8.3 Representing Relations 8.4 Closures of Relations 8.5 Equivalence.
8.2 n-ary Relations and Their Applications
Relations (1) Rosen 6 th ed., ch. 8. Binary Relations Let A, B be any two sets. A binary relation R from A to B, written (with signature) R:A↔B, is a.
Module #18: Relations, part I
Chapter 4 Relations and Digraphs
April 10, 2002Applied Discrete Mathematics Week 10: Relations 1 Counting Relations Example: How many different reflexive relations can be defined on a.
Chapter 9. Chapter Summary Relations and Their Properties Representing Relations Equivalence Relations Partial Orderings.
Lecture 14 Relations CSCI – 1900 Mathematics for Computer Science Fall 2014 Bill Pine.
Chapter 9. Chapter Summary Relations and Their Properties n-ary Relations and Their Applications (not currently included in overheads) Representing Relations.
Unit Unit 04 Relations IT DisiciplineITD1111 Discrete Mathematics & Statistics STDTLP1 Unit 4 Relations.
Relations and Their Properties
Discrete Math for CS Binary Relation: A binary relation between sets A and B is a subset of the Cartesian Product A x B. If A = B we say that the relation.
Chapter 9. Section 9.1 Binary Relations Definition: A binary relation R from a set A to a set B is a subset R ⊆ A × B. Example: Let A = { 0, 1,2 } and.
CSC-2259 Discrete Structures
Relations, Functions, and Matrices Mathematical Structures for Computer Science Chapter 4 Copyright © 2006 W.H. Freeman & Co.MSCS Slides Relations, Functions.
Sets Define sets in 2 ways  Enumeration  Set comprehension (predicate on membership), e.g., {n | n  N   k  k  N  n = 10  k  0  n  50} the set.
Discrete Structures1 You Never Escape Your… Relations.
Discrete Mathematics and Its Applications Sixth Edition By Kenneth Rosen Chapter 8 Relations 歐亞書局.
Chapter 7: Relations Relations(7.1) Relations(7.1) n-any Relations & their Applications (7.2) n-any Relations & their Applications (7.2)
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Relations.
Discrete Mathematics Relation.
Relations and their Properties
Relations, Functions, and Matrices Mathematical Structures for Computer Science Chapter 4 Copyright © 2006 W.H. Freeman & Co.MSCS Slides Relations, Functions.
Dr. Eng. Farag Elnagahy Office Phone: King ABDUL AZIZ University Faculty Of Computing and Information Technology CPCS 222.
Fall 2002CMSC Discrete Structures1 You Never Escape Your… Relations.
Mathematical Preliminaries
Lecture on Relations 1Developed by CSE Dept., CIST Bhopal.
Relation. Combining Relations Because relations from A to B are subsets of A x B, two relations from A to B can be combined in any way two sets can be.
Discrete Structures – CNS2300
Problem Statement How do we represent relationship between two related elements ?
Chapter 9. Chapter Summary Relations and Their Properties n-ary Relations and Their Applications (not currently included in overheads) Representing Relations.
Unit II Discrete Structures Relations and Functions SE (Comp.Engg.)
Representing Relations Using Matrices A relation between finite sets can be represented using a zero-one matrix Suppose R is a relation from A = {a 1,
Chapter Relations and Their Properties
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Relations.
Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A.
RelationsCSCE 235, Spring Introduction A relation between elements of two sets is a subset of their Cartesian products (set of all ordered pairs.
Relations and Functions ORDERED PAIRS AND CARTESIAN PRODUCT An ordered pair consists of two elements, say a and b, in which one of them, say a is designated.
Binary Relations Definition: A binary relation R from a set A to a set B is a subset R ⊆ A × B. Example: Let A = { 0, 1,2 } and B = {a,b} {( 0, a), (
Section 7.3: Representing Relations In this section, we will cover two ways to represent a relation over a finite set other than simply listing the relation.
Section 9.3. Section Summary Representing Relations using Matrices Representing Relations using Digraphs.
Binary Relation: A binary relation between sets A and B is a subset of the Cartesian Product A x B. If A = B we say that the relation is a relation on.
Discrete Mathematical
Relations and Their Properties
Chapter 5 Relations and Operations
Relations.
Relations Binary relations represent relationships between the elements of two sets. A binary relation R from set A to set B is defined by: R  A 
Relations Chapter 9.
Relations and Digraphs
Representing Relations
CSE115/ENGR160 Discrete Mathematics 04/28/11
CSE 504 Discrete Structures & Foundations of Computer Science
Applied Discrete Mathematics Week 10: Equivalence Relations
CS2210 Discrete Structures Relations
Applied Discrete Mathematics Week 6: Relations/Digraphs
Discrete Math (2) Haiming Chen Associate Professor, PhD
REVISION Relation. REVISION Relation Introduction to Relations and Functions.
Agenda Lecture Content: Relations (Relasi)
Presentation transcript:

Relations

Important Definitions We covered all of these definitions on the board on Monday, November 7 th. Definition 1 Definition 2 Definition 3 Definition 4 Definition 5

Remember A relation can be Symmetric and not antisymmetric R = { (1,3), (3,1)} on the set S = {1,2,3} Antisymmetric and not symmetric R = { (1,1) (1,2) } on the set S = {1,2} Symmetric and antisymmetric Equality relation Neither symmetric nor antisymmetric R= {1,2), (2,1), (1,3)} on the set S = (1,2,3}

Remember A relation can be Reflexive R = { (1,1), (2,2), (3,3)} on the set S = {1,2,3} Irreflexive R = { (1,2), (2,3)} Neither reflexive nor irreflexive R 1 = { (1,2), (2,1), (1,1)} on the set S= {1,2} R 2 = { (2,2) }

Combining Relations Since relations from A to B are subsets of A X B, two relations from A to B can be combined in any way two sets can be combined. Union Intersection Set difference

Composite Relations Let R be a relation from a set A to a set B and Let S be a relation from set B to set C. The composite of R and S is the relation consisting of the ordered pairs (a,c) where a  A, c  C, and for which there exists an element b  B such that (a,b)  R & (b,c)  S We denoted the composite of R and S by S ° R.

the Powers of a relation The powers of a relation R can be recursively defined from the definition of a composite of two relations. Let R be a relation on the set A. The powers R n, n = 1,2,3,…, are defined recursively by R 1 = R and R n+1 = R n ° R THEOREM: The relation R on a set A is transitive iff R n ⊆ R for n = 1,2,3, …

n-ARY RELATIONS Relations among elements of more than two sets often arise. Examples Student: name, major, gpa Airline flight: number, origin, destination, departure time, arrival time Points on a line Let A 1, A 2, …,A n be sets. An n-ary relation on these sets is a subset of A 1 X A 2 X… X A n

Relational Database Theory The sets A 1, A 2, …,A n are called the domains of the relation, and n is called its degree. The relational data model is based on the concept of a relation. A database consists of records which are n- tuples made up of fields. Relations used to represent database are also called tables. Each column of the table corresponds to an attribute of the database.

Database Keys A domain of an n-ary relation is called a primary key when the value of the n-tuple from this domain determines the n-tuple. Combinations of domains can also uniquely identify n-tuples in an n-ary relation. When the values of a set of domains determin an n- tuple in a relation, the Cartesian product of these domains is called a composite key.

Operations on n-ary relations Select Let R be an n-ary relation and C a condition that elements in R may satisfy. Then the selection operator s C maps the n-ary relation R to the n-ary relation of all n-tuples from R that satisfy the condition C. Project The projection P i1, i2, …im maps the n-tuple (a 1, a 2, …,a n ) to the m-tuple (a i1,a i2, …a im ), where m <= n.

Operations on n-ary relations Join Let R be a relation of degree m and S a relation of degree n. The join J p (R,S), where p <= m and p <= n, is a relation of degree m+n-p that consists of all (m+n-p)-tuples (a 1,a 2, …,a m-p, c 1,c 2,…,c p, b 1,b 2,…,b n-p ), where the m-tuple (a 1,a 2, …,a m-p, c 1,c 2,…,c p ) belongs to R and the n-tuple (c 1,c 2,…,c p,,b 1,b 2,…,b n-p ) belongs to S.

Representing relations using matrices A relation between finite sets can be represented using a zero-one matrix Suppose that R is a relations from A = {a1, a2, …, am} to B= {b1, b2, …, bn} The relation R can be represented by the matrix M R = [m ij ] where m ij = 1 if (a i,b j )  R, m ij = 0 if (a i,b j ) ∉ R

Representing relations using digraphs A directed graph, or digraph, consists of a set V of vertices (or nodes) together with a set E of ordered pairs of elements of V called edges (or arcs). The vertex a is called the initial vertex of the edge (a,b), and the vertex b is called the terminal vertex of this edge.

Partial Ordering A binary relation on a set S that is reflexive, antisymmetric, and transitive is called a partial ordering on S. Hasse diagram If S is finite, we can visually depict a partially ordered set by using a Hasse diagram. Each of the elements of S is represented by a dot, called a node or vertex of the diagram. If x is an immediate predecessor of y, then the node for y is placed above the node for x and the two nodes are connected by a straight line segment. Draw the Hasse diagram for the relation “x divides y” on the set {1,2,3,6,12,18} PERT (program evaluation and review technique) chart is a Hasse diagram with time added