Relations and Digraphs

Slides:



Advertisements
Similar presentations
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.
Advertisements

Chapter 3 Relations. Section 3.1 Relations and Digraphs.
Chap6 Relations Def 1: Let A and B be sets. A binary relation from A
Representing Relations Using Matrices
Applied Discrete Mathematics Week 11: Graphs
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?
Applied Discrete Mathematics Week 12: Trees
1 Representing Relations Part 2: directed graphs.
1/25/2005Tucker, Sec Applied Combinatorics, 4th Ed. Alan Tucker Section 1.2 Isomorphism Prepared by Jo Ellis-Monaghan.
Discrete Mathematics Lecture#11.
Relations Chapter 9.
Chapter 9 1. Chapter Summary Relations and Their Properties n-ary Relations and Their Applications (not currently included in overheads) Representing.
GRAPH Learning Outcomes Students should be able to:
Chapter 4 Relations and Digraphs
Chapter 9. Chapter Summary Relations and Their Properties Representing Relations Equivalence Relations Partial Orderings.
Chapter 9. Chapter Summary Relations and Their Properties n-ary Relations and Their Applications (not currently included in overheads) Representing Relations.
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2007 Chapter 9 (Part 2): Graphs  Graph Terminology (9.2)
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.
Based on slides by Y. Peng University of Maryland
Graph pattern matching Graph GGraph Qisomorphism f(a) = 1 f(b) = 6 f(c) = 8 f(d) = 3 f(g) = 5 f(h) = 2 f(i) = 4 f(j) = 7.
Rosen, Section 8.5 Equivalence Relations
Mathematical Preliminaries
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 Chapter 7 Relations 感謝 大葉大學 資訊工程系 黃鈴玲老師 提供.
Discrete Mathematics Lecture # 15 Types of Relations (contd.)
CSCI 115 Chapter 8 Topics in Graph Theory. CSCI 115 §8.1 Graphs.
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.
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.
Section 9.3. Section Summary Representing Relations using Matrices Representing Relations using Digraphs.
1 GRAPH Learning Outcomes Students should be able to: Explain basic terminology of a graph Identify Euler and Hamiltonian cycle Represent graphs using.
Chapter8 Relations 8.1: Relations and their properties.
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 Chapter 9 Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill.
Representing Relations Using Digraphs
Discrete Mathematical
Relations and Their Properties
Relations.
Applied Discrete Mathematics Week 14: Trees
CSE15 Discrete Mathematics 05/03/17
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.
Chapter 9 (Part 2): Graphs
Special Graphs By: Sandeep Tuli Astt. Prof. CSE.
Relations and Digraphs
Applied Discrete Mathematics Week 10: Relations
Representing Relations
RELATION KS MATEMATIKA DISKRIT (DISCRETE MATHEMATICS )
CS 173: Discrete Mathematical Structures
CSNB 143 Discrete Mathematical Structures
Taibah University College of Computer Science & Engineering Course Title: Discrete Mathematics Code: CS 103 Chapter 9 Relations Slides are adopted from.
Applied Discrete Mathematics Week 9: Equivalence Relations
Discrete Mathematics Chapter 7 Relations.
Based on slides by Y. Peng University of Maryland
Discrete Math (2) Haiming Chen Associate Professor, PhD
Isomorphism in GRAPHS.
Relations.
Equivalence Relations
Equivalence Relations
교환 학생 프로그램 내년 1월 중순부터 6월 초 현재 학부 2,3 학년?
Applied Discrete Mathematics Week 13: Graphs
Based on slides by Y. Peng University of Maryland
Chapter 8 (Part 2): Relations
Representing Relations Using Matrices
Relations 12/7/2019.
Presentation transcript:

Relations and Digraphs

Contents 1.Relations and Directed Graphs 2.Special Properties of Binary Relations 3.Equivalence Relations 4.Ordering Relations,Lattices,Enumeration 5.Operations on relations

Introduction Applications of relations are found throughout computer science and engineering, including relations between the inputs and outputs of computer programs, relations between data attributes in databases, and relations between symbols in computer languages.

Representing Relations using Digraphs Def 1. A directed graph (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). Example. Show the digraph of the relation R={(1,1),(1,3),(2,1),(2,3),(2,4), (3,1),(3,2),(4,1)} on the set {1,2,3,4}. Sol : 1 2 4 3 vertex : 1, 2, 3, 4 edge : (1,1), (1,3), (2,1), (2,3), (2,4), (3,1), (3,2), (4,1)

or or or ※ The relation R is reflexive iff for every vertex, (loop) x y ※ The relation R is symmetric iff for any vertices x≠y, either or x y ※ The relation R is antisymmetric iff for any x≠y, or or x y x y x y

※ The relation R is transitive iff for a, b, c A, (a, b)R and (b, c)R  (a, c)R. This means: a b d c a b d c 

Example. Determine whether the relations R and S are reflexive, symmetric, antisymmetric, and/or transitive a b c d S Sol : a b c R : reflexive, not symmetric, not antisymmetric, not transitive (a→b, b→c, a→c) not reflexive, symmetric not antisymmetric not transitive (b→a, a→c, b→c) irreflexive (a,a)R, aA

Equivalence Relations Def 1. A relation R on a set A is called an equivalence relation if it is reflexive, symmetric, and transitive. Example 1. Let R be the relation on the set of integers such that aRb if and only if a=b or a=-b. Then R is an equivalence relation. Example 2. Let R be the relation on the set of real numbers such that aRb if and only if a-b is an integer. Then R is an equivalence relation.

Example. (Congruence Modulo m) Let m  Z and m > 1. Show that the relation R={ (a,b) | a≡b (mod m) } is an equivalence relation on the set of integers. ( a is congruent to b modulo m) Sol : Note that a≡b(mod m) iff m | (a-b). ∵ a≡a (mod m)  (a, a)R  reflexive  If a≡b(mod m), then a-b=km, kZ  b-a= (-k)m  b≡a (mod m)  symmetric  If a≡b(mod m), b≡c(mod m) then a-b=km, b-c=lm  a-c=(k+l)m  a≡c(mod m)  transitive ∴ R is an equivalence relation.

Let l(x) denote the length of the string x. Suppose that the relation Example. Let l(x) denote the length of the string x. Suppose that the relation R={(a,b) | l(a)=l(b), a,b are strings of English letters } Is R an equivalence relation? Sol :  (a,a)R string a  reflexive  (a,b)R  (b,a)R  symmetric Yes.  (a,b)R,(b,c)R  (a,c)R  transitive Ch8-10 10

 xRx x since x- x =0  reflexive Example. Let R be the relation on the set of real numbers such that xRy if and only if x and y differ by less than 1, that is |x- y| < 1. Show that R is not an equivalence relation. Sol :  xRx x since x- x =0  reflexive  xRy  |x- y| < 1  |y- x| < 1  yRx  symmetric  xRy, yRz  |x- y| < 1, |y- z| < 1  |x- z| < 1  Not transitive  Ch8-11 11

Representing Relations using Digraphs Def 1. A directed graph (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).

A pair of sets G = (V, E) is a directed graph (digraph) if A pair of sets G = (V, E) is a directed graph (digraph) if . The elements of V are called vertices and the elements of E are called edges. An edge (x,y) is said to be from x to y, and is represented in a diagram by an arrow with the tail at x and the head at y. Such an edge is said to be incident from x, incident to y, and incident on both x and y. If there is an edge in E from x to y we say x is adjacent to y. The number of edges incident from a vertex is called the out-degree of the vertex and the number of edges incident to a vertex is called the in-degree. An edge from a vertex to itself is called a loop, and will ordinarily be permitted. A digraph with no loops is called loop-free or simple.

Identify Vertices, Edges of the below digraph Sarai, Abram, Isaac Edges (Sarai, Isaac), (Abram,Isaac) Identify in degree and out degree of each of those vertices Sarai In-0, out-1 Abram In-0, Out-1 Isaac In-2, Out-0

Out-degree – the number of edges incident from a vertex In-degree – the number of edges incident to a vertex Loop-free (or) simple digraph – a digraph with no loops

Find the in-degree and out-degree of

Paths in Directed Graphs Def 1. A path from a to b in the digraph G is a sequence of edges (x0, x1), (x1, x2), …, (xn-1, xn) in G, where nZ+, and x0= a, xn= b. This path is denoted by x0, x1, x2, …, xn and has length n. Ex. 1 3 5 2 4 A path from 1 to 5 of length 4 Theorem 1 Let R be a relation on a set A. There is a path of length n, where nZ+, from a to b if and only if (a, b)  Rn. Ch8-18 18

Proper Subgraph

Subgraphs Definition: if G is a graph, a subgraph H of G consists of a subset V of the vertices of G, and a subset of the edges of G with endpoints in V. c d e f n a b c d e f g h i j k l m o A graph G i l j k h g m Two subgraphs of G 1/25/2005 Tucker, Sec. 1.2

Induced subgraphs Choose a subset of the vertices of G, then include only the edges among those vertices. a b g f c e d e h j k d e h j k d h j k i l m o n Subgraph induced by the vertices of degree 4. A graph G 1/25/2005 Tucker, Sec. 1.2

Representing Graphs a b c d a b c d a, d b c a, b, c d b, c, d a Adjacent Vertices Vertex a b c a, b, c d Terminal Vertices Initial Vertex

Definition of Isomorphism Two graphs G and are isomorphic if : There exists a one-to-one correspondence between vertices in G and , such that There is an edge between a and b in G if and only if there is an edge between the corresponding vertices and in . The definition for oriented graphs is the same, except the head and tail of each edge of G must correspond to the head and tail in . 1/25/2005 Tucker, Sec. 1.2

Example of isomorphic graphs b 1 2 3 f 4 e 6 5 d c G An isomorphism between G and : a 6 d 5 b 1 e 2 c 3 f 4 Graph isomorphism is both very important and very intractable— Important: matching to known structures (eg chemical molecules, circuits, organizational solutions, visualizations) Intractable—no known good algorithms for determining if two graphs are isomorphic—brute force methods (eg start with one vertex, try all the ones it could match too, then try the next, etc) grow exponentially with the number of vertices. 1/25/2005 Tucker, Sec. 1.2

Isomorphic Graphs The two graphs below look different. Are from a graph theoretic point of view structurally the ‘same’? 2 b 1 3 a The renaming function f is an isomorphism. f.a = 1, f.b=3... Cycles and degree are preserved. c d 5 4 e

Graph Morphisms The two graphs below look different but are structurally the ‘same’. f.c 2(c) b f.a 1(a) 3(e) a c f.d The renaming function f is an isomorphism. f.a = 1, f.b=3... Cycles and degree are preserved. d 5(d) 4(b) e f.b f.e They are the ‘same’ up to the renaming of the vertices. These graphs are isomorphic.

Elementary properties of isomorphic graphs Edge and vertex counts Isomorphic graphs have the same number of edges and vertices. Vertex sequence (the list of vertex degrees) Isomorphic graphs have the same vertex sequences. Warning!! These can be used to show two graphs are not isomorphic, but can not show that two graphs are isomorphic. 1/25/2005 Tucker, Sec. 1.2

Two non-isomorphic graphs Vertices: 6 Edges: 7 Vertex sequence: 4, 3, 3, 2, 2, 0. Vertices: 6 Edges: 7 Vertex sequence: 5, 3, 2, 2, 1, 1. 1/25/2005 Tucker, Sec. 1.2

Subgraph properties of isomorphic graphs Isomorphic graphs have the same sets of subgraphs: there is a one-to-one correspondence between the subgraphs such that corresponding subgraphs are isomorphic. Typically check induced subgraphs, or number of a specific kind of subgraphs such as cycles or cliques. Warning!! These can be used to show two graphs are not isomorphic, but can not show that two graphs are isomorphic. Both edge reconstruction and vertex reconstruction are still open problems, The set of subgraphs you get by deleting each of the vertices (edges) singly is called the vertex (edge) deck of the graph. Can you prove that if two graphs have the same vertex/edge deck they must be isomorphic, or can you find a counter example? 1/25/2005 Tucker, Sec. 1.2

Two non-isomorphic graphs 1 4 a d 5 b e f g h 8 7 2 6 3 c 3 Vertices: 8 Edges: 10 Vertex sequence: 3, 3, 3, 3, 2, 2, 2, 2. Vertices: 8 Edges: 10 Vertex sequence: 3, 3, 3, 3, 2, 2, 2, 2. However, induced subgraphs on degree 3 vertices are NOT isomorphic! 1/25/2005 Tucker, Sec. 1.2

An approach to checking isomorphism: Count the vertices. The graphs must have an equal number. Count the edges. The graphs must have an equal number. Check vertex degree sequence. Each graph must have the same degree sequence. Check induced subgraphs for isomorphism. If the subgraphs are not isomorphic, then the larger graphs are not either. Count numbers of cycles/cliques. If these tests don’t help, and you suspect the graphs actually are isomorphic, then try to find a one-to-one correspondence between vertices of one graph and vertices of the other. Remember that a vertex of degree n in the one graph must correspond to a vertex of degree n in the other. 1/25/2005 Tucker, Sec. 1.2

For the class to try: Are these pairs of graphs isomorphic? 3 Isomorphic: a-1, b-5, c-4, d-3, e-2, f-6. a e 5 1 #1 c d b f 2 6 4 d Not Isomorphic: 5 K3’s on left, 4 K3’s on right. 1 2 a b c 5 6 #2 7 3 e g 4 f 1/25/2005 Tucker, Sec. 1.2

Problems

Solution for 1(a)

Solution for 1(b)

Solution for 1(c)

Example for Transitive relation

Example for not a Transitive relation

Example for Reflexive relation

Example for Irreflexive relation

Example for Symmetric relation

Example for Antisymmetric relation

Equivalence relation – A binary relation that is transitive, reflexive and symmetric is called an equivalence relation Partial ordering relation – A binary relation that is transitive, reflexive and antisymmetric is called a partial ordering relation

Problem

Solution