8.3 Representing Relations Directed Graphs –Vertex –Arc (directed edge) –Initial vertex –Terminal vertex.

Slides:



Advertisements
Similar presentations
Partial Orderings Section 8.6.
Advertisements

CSCI 115 Chapter 6 Order Relations and Structures.
Relations Relations on a Set. Properties of Relations.
8.6 Partial Orderings. Definition Partial ordering– a relation R on a set S that is Reflexive, Antisymmetric, and Transitive Examples? R={(a,b)| a is.
Representing Relations Using Matrices
Chapter 7 Relations : the second time around
1 Relations: The Second Time Around Chapter 7 Equivalence Classes.
Relations binary relations xRy on sets x  X y  Y R  X  Y Example: “less than” relation from A={0,1,2} to B={1,2,3} use traditional notation 0 < 1,
Partial Orderings: Selected Exercises
1 Partial Orderings Based on Slides by Chuck Allison from Rosen, Chapter 8.6 Modified by.
Partially Ordered Sets (POSets)
Relations Chapter 9.
Chapter 9 1. Chapter Summary Relations and Their Properties n-ary Relations and Their Applications (not currently included in overheads) Representing.
Relations (3) Rosen 6th ed., ch fall.
Chapter 6. Order Relations and Structure
Applied Discrete Mathematics Week 10: Equivalence 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.
Exam 2 Review 8.2, 8.5, 8.6, Thm. 1 for 2 roots, Thm. 2 for 1 root Theorem 1: Let c 1, c 2 be elements of the real numbers. Suppose r 2 -c 1.
Exam 2 Review 7.5, 7.6, |A1  A2  A3| =∑|Ai| - ∑|Ai ∩ Aj| + |A1∩ A2 ∩ A3| |A1  A2  A3  A4| =∑|Ai| - ∑|Ai ∩ Aj| + ∑ |Ai∩ Aj ∩ Ak| - |A1∩
1 Partial Orderings Aaron Bloomfield CS 202 Rosen, section 7.6.
Properties of Relations In many applications to computer science and applied mathematics, we deal with relations on a set A rather than relations from.
Chapter 4 Relations and Digraphs
Chapter 9. Chapter Summary Relations and Their Properties Representing Relations Equivalence Relations Partial Orderings.
Discrete Structures – CNS2300
Chapter 9. Chapter Summary Relations and Their Properties n-ary Relations and Their Applications (not currently included in overheads) Representing Relations.
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.
2.6 Equivalence Relation §1.Equivalence relation §Definition 2.18: A relation R on a set A is called an equivalence relation if it is reflexive, symmetric,
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.
Relations, Functions, and Matrices Mathematical Structures for Computer Science Chapter 4 Copyright © 2006 W.H. Freeman & Co.MSCS Slides Relations, Functions.
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 歐亞書局.
Fall 2015 COMP 2300 Discrete Structures for Computation Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1.
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.
Sets and Subsets Set A set is a collection of well-defined objects (elements/members). The elements of the set are said to belong to (or be contained in)
1 Partial Orderings Aaron Bloomfield CS 202 Epp, section ???
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.
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.
4. Relations and Digraphs Binary Relation Geometric and Algebraic Representation Method Properties Equivalence Relations Operations.
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
Relations Section 9.1, 9.3—9.5 of Rosen Spring 2012
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.
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.
Chap. 7 Relations: The Second Time Around
1 Partial Orderings Based on Slides by Chuck Allison from Rosen, Chapter 8.6 Modified by.
Section 9.3. Section Summary Representing Relations using Matrices Representing Relations using Digraphs.
Chapter8 Relations 8.1: Relations and their properties.
1 Partial Orderings Epp, section Introduction An equivalence relation is a relation that is reflexive, symmetric, and transitive A partial ordering.
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.
Relations and Their Properties
Chapter 5 Relations and Operations
Partial Orderings: Selected Exercises
Chapter 6 Order Relations and Structures
CSE 2813 Discrete Structures
Unit-III Algebraic Structures
Partial Orders.
Partial Orderings CSE 2813 Discrete Structures.
Introduction to 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 
Equivalence Relations
Relations Chapter 9.
Partial Orderings.
Relations and Digraphs
Discrete Math (2) Haiming Chen Associate Professor, PhD
Relations.
교환 학생 프로그램 내년 1월 중순부터 6월 초 현재 학부 2,3 학년?
Relations: The Second Time Around
Presentation transcript:

8.3 Representing Relations Directed Graphs –Vertex –Arc (directed edge) –Initial vertex –Terminal vertex

Example Draw the “divides” relation on the set {2,3,4,5,6,7,8,9} as a directed graph

The zero-one Matrix Representation M R M R is just a zero-one version of the “chart” representation of R

Reflexivity Directed graph pictureZero-one matrix picture

Symmetry Directed graph pictureZero-one matrix picture

Antisymmetry Directed graph pictureZero-one matrix picture

Transitivity Directed graph pictureZero-one matrix picture

Theorem For relations R 1 and R 2 on set A,

Corollary For a relation R on set A, for any positive integer n.

8.4 Closures of Relations Reflexive closure Symmetric closure

Paths in Directed Graphs A path in a directed graph is a sequence of vertices for which any two consecutive vertices a i and a i+1 in the sequence are joined by an arc from a i to a i+1. Theorem: Let R be a relation on set A, and n a positive integer. Then there is a path of length n from a to b in R if and only if (a,b) is in R n.

Example:

The “Connectivity Relation” R* Let R be a relation on set A. We define

The Transitive Closure For a relation R on a set A, we define the transitive closure of R to be the smallest transitive relation containing R. Theorem:

Finding transitive closure the “hard” way:

Computing R* If A is a set with n elements, and R is a relation on A, then any time there is a path of length one or more from a to b in R then there is a path of length n or less. So actually and Interestingly, this is not the best way of computing R*

Computing transitive closure the better way:

Warshall’s Algorithm procedure Warshall(M R : n by n zero-one matrix) W := M R for k:=1 to n for i:=1 to n for j:=1 to n w ij := w ij  (w ik  w kj ) { W now contains M R* }

Illustration of Warshall’s Algorithm

8.5 Equivalence Relations Definition: A relation R on set A is an equivalence relation if …

Examples aRb if and only if a and b have the same first name (on the set of students in this class) aRb if and only if a ≡ b (mod 5) (on the set of integers)

Equivalence Classes If R is a relation on set A, and a is an element of A, then…

Examples (continued) [Michael] [4] 5

Theorem For an equivalence relation R on set A and elements a and b of A, the following are all logically equivalent: a)a R b b)[a] R = [b] R c)[a] R  [b] R  

Partitions For a set S, a partition of S is a collection  = {A 1, A 2, …, A m } of nonempty subsets of S which satisfies the following properties: –Every element of A is in one of the sets A i. –For all i, j  {1, 2, …, m}, if i  j then A i  A j =  Terminology: We say that the collection  partitions S.

Theorem Let R be an equivalence relation on set S. Then the equivalence classes of R partition S. Conversely, for any partition  of S there is an equivalence relation R whose equivalence classes are the sets in .

…,,,-8,,,-5,,,-2,,,1,,,4,,,7,,,10, … …,,-9,,,-6,,,-3,,,0,,,3,,,6,,,9,, … …,-10,,,-7,,,-4,,,-1,,,2,,,5,,,8,,, … …,,-9,,,-6,,,-3,,,0,,,3,,,6,,,9,, ……,,,-8,,,-5,,,-2,,,1,,,4,,,7,,,10, … Visual [2]={…,-10, -7, -4, -1, 2, 5, 8, …} [0]={…,-9, -6, -3, 0, 3, 6, 9, …} [1]={…,-8, -5, -2, 1, 4, 7, 10, …}

…,,,-8,,,-5,,,-2,,,1,,,4,,,7,,,10, … …,,-9,,,-6,,,-3,,,0,,,3,,,6,,,9,, … Visual …,-10,,,-7,,,-4,,,-1,,,2,,,5,,,8,,, … [2]={…,-10, -7, -4, -1, 2, 5, 8, …} [0]={…,-9, -6, -3, 0, 3, 6, 9, …} [1]={…,-8, -5, -2, 1, 4, 7, 10, …}

Example: Turning a partition into an equivalence relation

Zero-One Matrix Representation of an Equivalence Relation Examples

Digraph Representation of an Equivalence Relation Examples

Equivalence as “sameness” Almost every equivalence relation definition comes down to identifying some notion of “sameness” –Same remainder when divided by n –Same name –Same set of a partition

Number of Partitions of a Set with n Elements n = 1 n = 2 n = 3 n = 4

Recurrence Relation for the Number of Partitions of a Set with n Elements

8.6 Partial Orderings Let A be a set, and R a relation on A. We say that R is a partial ordering if and only if… In this case we say that the pair (A, R ) is a partially ordered set (poset).

Examples: 1.The real numbers R under the  relation 2.The real numbers R under the  relation 3.The positive integers under the “divides” relation 4.Any set of sets under the  (subset) relation 5.The cartesian product Z  Z under the “( ,  )” relation R. (i.e. (x,y) R (z,w) if and only if x  z and y  w.)

Convention

Comparable and Incomparable Elements

Examples:

Total Orderings

Well-Ordered Sets

Hasse Diagrams Begin with the digraph representation of the partial ordering Omit the reflexive loops Omit all edges which would be implied by transitivity Orient all vertices and arcs so that the direction of each arc is up. Remove the direction arrow from each arc

Hasse Diagram Example I Pairs in {1,2,3}  {1,2,3} under lexicographic order

Hasse Diagram Example I Pairs in {1,2,3}  {1,2,3} under lexicographic order

Hasse Diagram Example I Pairs in {1,2,3}  {1,2,3} under lexicographic order

Hasse Diagram Example I

Pairs in {1,2,3}  {1,2,3} under lexicographic order Hasse Diagram Example I

Hasse Diagram Example II Integers 1-12 under “divides”

Hasse Diagram Example III Integers 1-12 under “divides”

Maximal and Minimal Elements

Theorems Every finite poset has a minimal element Every finite poset has a maximal element

Example: Maximal Elements? Minimal Elements? Greatest Element? Least Element?

Upper Bounds and Lower Bounds

Example: Find the upper and lower bounds of the subsets {c,f}, {h,i}, {c,d,e}. Find the greatest lower bound and the least upper bound of {b,d} and {a,b,g}.

Topological Sorts

Topological Sort Algorithm Procedure TopologicalSort(S: finite poset) Let q be a queue of elements of S, initially empty While S is not empty, do begin Choose and enqueue a minimal element s of S onto the queue q. Remove s from S End { The queue q now contains all the elements of S, arranged in a compatible total ordering of S. }

Topological Sort Trace