Lecture 17

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 13

Composition of

Relations
Definition: Suppose
• R1 is a relation from a set A to a set B.
• R2 is a relation from B to a set C.
Then the composition (or composite) of R2
with R1, is a relation from A to C where

of R2, then (x,z) is a member of R2∘ R1.


• if (x,y) is a member of R1 and (y,z) is a member
Representing the Composition
of a Relation

R1 m R2 w
a
x
n
b
y
o
c
p z
Composition of Relations
What is the composite of the relations R and S, where

• R is the relation from {1,2,3} to {1,2,3,4} with


R = {(1,1),(1,4),(2,3),(3,1),(3,4)}
• S is the relation from {1,2,3,4} to {0,1,2} with
S = {(1,0),(1,2),(2,0),(3,1),(3,2),(4,1)}?
• S o R = {(1,0),(1,2),(1,1), (2,2),(2,1), (3,0),(3,2),(3,1)}
9.2 n-ary Relations and Their Applications
9.2 n-ary Relations and Their Applications
9.2 n-ary Relations and Their Applications
Databases and Relations
A database consists of records, which are n-tuples, made up of fields. The
fields are the entries of the n-tuples. For instance, a database of student
records may be made up of fields containing the name, student number, major,
and grade point average of the student. The relational data model represents
a database of records as an n-ary relation. Thus, student records
Databases and Relations
Records are often added to or deleted from databases. Because of this, the property that a
domain is a primary key is time-dependent. Consequently, a primary key should be chosen
that remains one whenever the database is changed. The current collection of n-tuples in a
relation is called the extension of the relation. The more permanent part of a database,
including the name and attributes of the database, is called its intension. When selecting a
primary key, the goal should be to select a key that can serve as a primary key for all possible
extensions of the database. To do this, it is necessary to examine the intension of the
database to understand the set of possible n-tuples that can occur in an extension
Operations on n-ary Relations
Projects

• Sudoku
• Vending Machine
• Scene Understanding
• Digital Clock
• Stop Watch
• Room Allocation in a Hostel
• Customer support service
• Flight Assistant service
Project Report Template for a
Discrete Mathematics (DM) Project
• Title Page
• Project Title:
• Group members
• Institution Name and logo
• Course/Subject Name:
• Submission Date:
• Project Supervisor Name
Table of Contents
1.Introduction
2.Objectives
3.Problem Statement
4.Background and Literature Review
5.Methodology
6.Algorithm/Mathematical Model
7.Implementation Discussion
8.Results and Discussion
9.Conclusion
10.Future Work
11.References
12.Appendices (if any)

You might also like