1 / 7

Relations

Relations. Generalization of function Any set of ordered pairs Examples & properties. Relations. Within some set, the elements may have some relationship Can be depicted by A formula List/set of ordered pairs Directed graph Adjacency matrix

darius
Download Presentation

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. Relations • Generalization of function • Any set of ordered pairs • Examples & properties

  2. Relations • Within some set, the elements may have some relationship • Can be depicted by • A formula • List/set of ordered pairs • Directed graph • Adjacency matrix • Example: the “<“ relation on the set { 1, 2, 3, 4 } • 1 points to 2, 3, 4 • etc. • Standard notation: xRy means “x is related to y” where R is the name of the relation.

  3. Examples Let S = { 1, 2, 3, 4, 5 }. Relations will be over this set. • xRy if y = x + 1 • A special case of a relation is a function. All functions are relations, but not all relations are functions! • xRy if y = x  1 • R = S  S • This is called the complete relation. • xRy if x mod 3 = y mod 3 • What if we had more numbers in S? • xRy = x | y

  4. Properties of relations • Reflexive x: xRx • Symmetric x,y: xRy yRx • Antisymmetric x,y: (x  y  xRy)  ~ yRx • Transitive x,y,z: (xRy  yRz)  xRz • Definite x,y: xRy  yRx

  5. Adjacency matrix • Relation properties are sometimes easier to discern if you look at an adjacency matrix. • Reflexive: All 1’s along main diagonal • Symmetric  • Anti-symmetric: Away from main diagonal, all 1’s have a 0 across the main diagonal (mirror image). • Transitive – not much help • Definite: Main diagonal is all 1’s, and for each other cell, either it or its mirror image is a 1.

  6. Try these For the relational operators, let’s assume that the underlying set of objects is some subset of the integers, e.g. { 1, 2, 3 }.

  7. Properties cont’d • Equivalence relation = a relation that is reflexive, symmetric, and transitive. • Useful when you want a collection of objects to be grouped into some partitions • What are some examples? • Partial/total order: • Useful when the set of objects need to be ranked • Many relations are possible. For example, for a set of 3 elements, you can have 512 possible relations. However, most are not useful.

More Related