CSE 311: Foundations of Computing Fall 2014 Lecture 20: Relations and Directed Graphs.

Slides:



Advertisements
Similar presentations
CSE115/ENGR160 Discrete Mathematics 04/26/12 Ming-Hsuan Yang UC Merced 1.
Advertisements

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
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.
8.4 Closures of Relations. Intro Consider the following example (telephone line, bus route,…) abc d Is R, defined above on the set A={a, b, c, d}, transitive?
CS2210(22C:19) Discrete Structures Relations Spring 2015 Sukumar Ghosh.
CSE115/ENGR160 Discrete Mathematics 04/24/12 Ming-Hsuan Yang UC Merced 1.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2001 Wednesday, 9/26/01 Graph Basics.
CSE 311 Foundations of Computing I Lecture 19 Relations Autumn 2011 CSE 3111.
1 Section 7.1 Relations and their properties. 2 Binary relation A binary relation is a set of ordered pairs that expresses a relationship between elements.
Applied Discrete Mathematics Week 10: Equivalence Relations
Chapter 4 Relations and Digraphs
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.
Lecture 17 Trees CSCI – 1900 Mathematics for Computer Science Fall 2014 Bill Pine.
Unit Unit 04 Relations IT DisiciplineITD1111 Discrete Mathematics & Statistics STDTLP1 Unit 4 Relations.
Relations and Their Properties
CSE 311 Foundations of Computing I Lecture 21 Finite State Machines Autumn 2011 CSE 3111.
CSE 311 Foundations of Computing I Lecture 21 Finite State Machines Spring
Mathematical Preliminaries. Sets Functions Relations Graphs Proof Techniques.
CSC-2259 Discrete Structures
8.3 Representing Relations Directed Graphs –Vertex –Arc (directed edge) –Initial vertex –Terminal vertex.
1 Closures of Relations: Transitive Closure and Partitions Sections 8.4 and 8.5.
Discrete Mathematics and Its Applications Sixth Edition By Kenneth Rosen Chapter 8 Relations 歐亞書局.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Relations.
Discrete Mathematics Relation.
Relations and their Properties
CHAPTER 3 FUZZY RELATION and COMPOSITION. 3.1 Crisp relation Product set Definition (Product set) Let A and B be two non-empty sets, the product.
Fall 2002CMSC Discrete Structures1 You Never Escape Your… Relations.
CSE 311 Foundations of Computing I Lecture 22 Relations, Database Autumn 2012 CSE TexPoint fonts used in EMF. Read the TexPoint manual before you.
Relations. Important Definitions We covered all of these definitions on the board on Monday, November 7 th. Definition 1 Definition 2 Definition 3 Definition.
1 Chapter Equivalence, Order, and Inductive Proof.
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.
CSE 311 Foundations of Computing I Lecture 20 Relations, Graphs, Finite State Machines Autumn 2011 CSE 3111 TexPoint fonts used in EMF. Read the TexPoint.
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.
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
1 Section 4.1 Properties of Binary Relations A binary relation R over a set A is a subset of A  A. If (x, y)  R we also write x R y. Example. Some sample.
8.4 Closures of Relations Definition: The closure of a relation R with respect to property P is the relation obtained by adding the minimum number of.
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), (
1 Closures of Relations Based on Aaron Bloomfield Modified by Longin Jan Latecki Rosen, Section 8.4.
CSE 311 Foundations of Computing I Lecture 19 Recursive Definitions: Context-Free Grammars and Languages Spring
Section 9.3. Section Summary Representing Relations using Matrices Representing Relations using Digraphs.
Lecture 7: Relations Dr Andrew Purkiss-Trew Cancer Research UK Mathematics for Computing.
Chapter8 Relations 8.1: Relations and their properties.
Representing Relations Using Digraphs
Relations.
Aaron Bloomfield CS 202 Rosen, section 7.4
CSNB 143 Discrete Mathematical Structures
Lecture 4.3: Closures and Equivalence Relations
CSE 311 Foundations of Computing I
CS2210 Discrete Structures Relations
Relations (sections 7.1 – 7.5)
Relations: representation and closures
Closures of Relations: Transitive Closure and Partitions
CSE 321 Discrete Structures
CSE 321 Discrete Structures
CSE 311: Foundations of Computing
CSE 321 Discrete Structures
Discrete Math (2) Haiming Chen Associate Professor, PhD
Graphs G = (V, E) V are the vertices; E are the edges.
REVISION Relation. REVISION Relation Introduction to Relations and Functions.
Closures of Relations Epp, section 10.1,10.2 CS 202.
Chapter 8 (Part 2): Relations
Agenda Lecture Content: Relations (Relasi)
Representing Relations Using Matrices
Presentation transcript:

CSE 311: Foundations of Computing Fall 2014 Lecture 20: Relations and Directed Graphs

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

Relations You Already Know!

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 }

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 transitive iff (a,b)  R and (b, c)  R implies (a, c)  R

Combining Relations

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

Powers of a Relation

Matrix Representation {(1, 1), (1, 2), (1, 4), (2,1), (2,3), (3,2), (3, 3), (4,2), (4,3)}

Directed Graphs Path: v 0, v 1, …, v k, with (v i, v i+1 ) in E Simple Path Cycle Simple Cycle G = (V, E) V – vertices E – edges, ordered pairs of vertices

Representation of Relations Directed Graph Representation (Digraph) {(a, b), (a, a), (b, a), (c, a), (c, d), (c, e) (d, e) } ad e bc

Relational Composition using Digraphs

Paths in Relations and Graphs Let R be a relation on a set A. There is a path of length n from a to b if and only if (a,b)  R n A path in a graph of length n is a list of edges with vertices next to each other.

Connectivity In Graphs Let R be a relation on a set A. The connectivity relation R* consists of the pairs (a,b) such that there is a path from a to b in R. Note: The text uses the wrong definition of this quantity. What the text defines (ignoring k=0) is usually called R + Two vertices in a graph are connected iff there is a path between them.

Properties of Relations (again) 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 transitive iff (a,b)  R and (b, c)  R implies (a, c)  R

Transitive-Reflexive Closure Add the minimum possible number of edges to make the relation transitive and reflexive. The transitive-reflexive closure of a relation R is the connectivity relation R*

how is Anderson related to Ber noul?

CSE

BauerCaratheodoryMinkowski Klein LipschitzDirichletFourier LagrangeEuler Johann BernoulliJacob Bernoulli Leibniz RheticusCopernicus Anderson Weigel Mayr

Beame CookQuineWhiteheadHopkins SedgewickSmith NewtonBarrowGalileo

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

n-ary Relations

Relational Databases Student_NameID_NumberOfficeGPA Knuth Von Neuman Russell Einstein Newton Karp Bernoulli STUDENT

Relational Databases Student_NameID_NumberOfficeGPACourse Knuth CSE311 Knuth CSE351 Von Neuman CSE311 Russell CSE312 Russell CSE344 Russell CSE351 Newton CSE312 Karp CSE311 Karp CSE312 Karp CSE344 Karp CSE351 Bernoulli CSE351 What’s not so nice? STUDENT

relational databases ID_NumberCourse CSE CSE CSE CSE CSE CSE CSE CSE CSE CSE CSE CSE351 Better Student_NameID_NumberOfficeGPA Knuth Von Neuman Russell Einstein Newton Karp Bernoulli STUDENT TAKES

database operations: projection Office OfficeGPA

database operations: selection Find students with GPA > 3.9 : σ GPA>3.9 (STUDENT) Student_NameID_NumberOfficeGPA Knuth Karp Retrieve the name and GPA for students with GPA > 3.9: Π Student_Name,GPA (σ GPA>3.9 (STUDENT)) Student_NameGPA Knuth4.00 Karp3.98

database operations: natural join Student_NameID_NumberOfficeGPACourse Knuth CSE311 Knuth CSE351 Von Neuman CSE311 Russell CSE312 Russell CSE344 Russell CSE351 Newton CSE312 Karp CSE311 Karp CSE312 Karp CSE344 Karp CSE351 Bernoulli CSE351 Student ⋈ Takes