1 / 6

Section 7.3: Representing Relations

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 elements or using set builder notation to specify the elements in the relation. Representing Relations Using Matrices.

grover
Download Presentation

Section 7.3: Representing Relations

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 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 elements or using set builder notation to specify the elements in the relation

  2. Representing Relations Using Matrices Let A = {a1, a2, …, an} be a finite set. Then we can represent a relation R over the set A using an n by n matrix: _ _ | e11 e12 … e1n | | e21 e22 … e2n | | … … … … | |en1 en2 … enn| where entry eij = 1 if (ai, aj)  R and eij = 0 if (ai, aj)  R. Ex: Let A = {1, 2, 3} and R = {(1,1), (1, 2), (2, 3), (3, 1)}. Then _ _ | 1 1 0 | | 0 0 1 | |1 0 0| is the 3 by 3 zero-one matrix that represents the relation R.

  3. This representation can be generalized in the obvious way to represent a relation R from A to B where both A and B are finite sets with m and n elements respectively. Then an m by n zero-one matrix can be used to represent the relation R. Ex: Let A = {1, 2, 3}, B = {a, b} and R = {(1,b), (2, a), (2, b)}. Then _ _ | 0 1 | | 1 1 | |0 0| is the 3 by 2 zero-one matrix that represents the relation R. We can use the matrix representation to store relations in a computer and efficiently perform certain operations on relations using matrix operations. We can also use the matrix representation of a relation to investigate whether the relation satisfies the various properties introduced in section 7.1.

  4. We will concentrate on square matrices since most of the properties we introduced only apply to relations over a set A. _ _ | e11 e12 e13 … e1n | | e21 e22 e23 … e2n | | e31 e32 e33 … e3n | | … … … … … | |en1 en2 en3 … enn| Reflexive? Irreflexive? Symmetric? We can also use the matrix representation of a relation to compute the composite of two relations R and S. To compute S  R we simply multiply the matrix representing R with the matrix representing S. Note that this is a boolean matrix multiplication, meaning that the resulting entry can only be 0 or 1. So entries that exceed 1 when multiplied are returned to the value 1 for the resulting matrix.

  5. Representing Relations Using Digraphs While the matrix representation is convenient for working with relations in a computer, a digraph representation is a more visually appealing way to represent a relation on a finite set. Let A = {a1, a2, …, a3} and let R be a relation on A. For the digraph representation of R, we use a labeled dot to represent each element of A. Then for each pair (aj, ak) that is in R, we draw an arrow coming out of dot aj and that points to dot ak. Ex: Let A = {1, 2, 3, 4} and R = {(1, 2), (2, 1), (2, 2), (3, 4)}. •   2 • 3   4

  6. Reflexive: The relation represented by a digraph is reflexive if and only if there is a loop at every vertex. Irreflexive: The relation represented by a digraph is irreflexive if and only if there is not a loop at any vertex. Symmetric: The relation represented by a digraph is symmetric if and only if all arrows (other than loops) come in pairs with reverse direction. Antisymmetric: The relation represented by a digraph is antisymmetric if and only if there are no pairs of arrows with reverse direction. Transitive: The relation represented by a digraph is transitive if and only if there is an edge from a to b whenever there is a path from a to b for all nodes a and b.

More Related