§7.3 Representing Relations Longin Jan Latecki

Slides:



Advertisements
Similar presentations
Representing Relations
Advertisements

CSE 211- Discrete Structures
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.
Representing Relations Using Matrices
Module #1 - Logic 1 Based on Rosen, Discrete Mathematics & Its Applications. Prepared by (c) , Michael P. Frank and Modified By Mingwu Chen Relations.
Discrete Mathematics Lecture#11.
1 Representing Relations Epp section ??? CS 202 Aaron Bloomfield.
Applied Discrete Mathematics Week 10: Equivalence Relations
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 #21 - Relations Representing Relations Rosen 6 th ed., Ch. 8.
Module #18: Relations, part I
Lecture 14 Relations CSCI – 1900 Mathematics for Computer Science Fall 2014 Bill Pine.
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.
Representing Relations
Relations. Important Definitions We covered all of these definitions on the board on Monday, November 7 th. Definition 1 Definition 2 Definition 3 Definition.
이산수학 (Discrete Mathematics) 7.3 관계의 표현 (Representing Relations) 2006 년 봄학기 문양세 강원대학교 컴퓨터과학과.
Discrete Mathematics Lecture # 15 Types of Relations (contd.)
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.
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
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.
Relations. L222 Agenda –Relations 7.3 Representing Relations As subsets of Cartesian products Column/line diagrams Boolean matrix Digraph Operations on.
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.
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.
Module Code MA1032N: Logic Lecture for Week Autumn.
15.1 CompSci 102© Michael Frank Today’s topics RelationsRelations –Kinds of relations –n-ary relations –Representations of relations Reading: Sections.
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.
Representing Relations Using Digraphs
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.
Lecture 5.2: Special Graphs and Matrix Representation
Lecture # 14 Types of Relations
Relations and Digraphs
Representing Relations
Dr. Ameria Eldosoky Discrete mathematics
CSE115/ENGR160 Discrete Mathematics 04/28/11
Relations Rosen 5th ed., ch. 7.
CS 250, Discrete Structures, Fall 2015
CSNB 143 Discrete Mathematical Structures
CMSC Discrete Structures
Chapter 2 Sets Homework 3 Given U = { 1, 2, 3, 4, 5, 6, 7, 8, 9 } as a set universe and the sets : A = { 1, 2, 3, 4, 5 }, B = { 4, 5, 6, 7 }, C = { 5,
Discrete Mathematics and its Applications
Applied Discrete Mathematics Week 10: Equivalence Relations
§7.3 Representing Relations Longin Jan Latecki
CS2210 Discrete Structures Relations
Rosen 5th ed., ch. 7 ~32 slides (in progress), ~2 lectures
Relations (sections 7.1 – 7.5)
Discrete Mathematics and its Applications
2/18/2019 §7.1 Binary Relations (2nd pass) and §7.2 n-ary Relations Longin Jan Latecki Slides adapted from Kees van Deemter who adopted them from Michael.
Discrete Mathematics and its Applications
2/25/2019 §7.1 Binary Relations (2nd pass) and §7.2 n-ary Relations Longin Jan Latecki Slides adapted from Kees van Deemter who adopted them from Michael.
Properties of Relations
Discrete Math (2) Haiming Chen Associate Professor, PhD
Combining relations via relational composition
Discrete Mathematics and its Applications
Discrete Mathematics and its Applications
REVISION Relation. REVISION Relation Introduction to Relations and Functions.
7/30/2019 §7.1 Binary Relations (2nd pass) and §7.2 n-ary Relations Longin Jan Latecki Slides adapted from Kees van Deemter who adopted them from Michael.
Chapter 8 (Part 2): Relations
Agenda Lecture Content: Relations (Relasi)
Representing Relations Using Matrices
Discrete Mathematics and its Applications
Relations 12/7/2019.
4.4 Properties of Relations
Presentation transcript:

§7.3 Representing Relations Longin Jan Latecki 6/30/2019 §7.3 Representing Relations Longin Jan Latecki Slides adapted from Kees van Deemter who adopted them from Michael P. Frank’s Course Based on the Text Discrete Mathematics & Its Applications (5th Edition) by Kenneth H. Rosen A word about organization: Since different courses have different lengths of lecture periods, and different instructors go at different paces, rather than dividing the material up into fixed-length lectures, we will divide it up into “modules” which correspond to major topic areas and will generally take 1-3 lectures to cover. Within modules, we have smaller “topics”. Within topics are individual slides. The instructor can bring several modules to each lecture with him, to make sure he has enough material to fill the lecture, or in case he wants to preview or review slides from upcoming or recent past lectures. 6/30/2019

§7.3: Representing Relations Some ways to represent n-ary relations: With a list of tuples. With a function from the domain to {T,F}. Special ways to represent binary relations: With a zero-one matrix. With a directed graph. 6/30/2019

Why bother with alternative representations? Is one not enough? One reason: some things are easier using one representation, some things are easier using another It’s often worth playing around with different representations! 6/30/2019

Connection or (Zero-One) Matrices Let R be a relation from A = {a1, a2, . . . , am} to B = {b1, b2, . . . , bn}. Definition: An m x n connection matrix M for R is defined by Mij = 1 if <ai, bj> is in R, Mij = 0 otherwise. 6/30/2019

Using Zero-One Matrices To represent a binary relation R:A×B by an |A|×|B| 0-1 matrix MR = [mij], let mij = 1 iff (ai,bj)R. E.g., Suppose Joe likes Susan and Mary, Fred likes Mary, and Mark likes Sally. Then the 0-1 matrix representation of the relation Likes:Boys×Girls relation is: 6/30/2019

Special case 1-0 matrices for a relation on A (that is, R:A×A) Convention: rows and columns list elements in the same order 6/30/2019

• R is reflexive iff Mii = 1 for all i. Theorem: Let R be a binary relation on a set A and let M be its connection matrix. Then • R is reflexive iff Mii = 1 for all i. • R is symmetric iff M is a symmetric matrix: M = MT • R is antisymetric if Mij = 0 or Mji = 0 for all i ≠ j. 6/30/2019

Zero-One Reflexive, Symmetric Recall: Reflexive, irreflexive, symmetric, and asymmetric relations. These relation characteristics are very easy to recognize by inspection of the zero-one matrix. any- thing any- thing anything anything any- thing any- thing Reflexive: only 1’s on diagonal Irreflexive: only 0’s on diagonal Symmetric: all identical across diagonal Asymmetric: all 1’s are across from 0’s 6/30/2019

Using Directed Graphs A directed graph or digraph G=(VG,EG) is a set VG of vertices (nodes) with a set EGVG×VG of edges (arcs). Visually represented using dots for nodes, and arrows for edges. A relation R:A×B can be represented as a graph GR=(VG=AB, EG=R). Edge set EG (blue arrows) Matrix representation MR: Graph rep. GR: Joe Susan Fred Mary Mark Sally Node set VG (black dots) 6/30/2019

Digraph Reflexive, Symmetric It is easy to recognize the reflexive/irreflexive/ symmetric/antisymmetric properties by graph inspection.            Reflexive: Every node has a self-loop Irreflexive: No node links to itself Symmetric: Every link is bidirectional Asymmetric: No link is bidirectional These are not symmetric & not asymmetric These are non-reflexive & non-irreflexive 6/30/2019

6/30/2019

Given the connection matrix for two relations, how does Obvious questions: Given the connection matrix for two relations, how does one find the connection matrix for • The complement? • The symmetric difference? 6/30/2019

6/30/2019

Example 6/30/2019

Question: 6/30/2019