{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

24 Slides--Functions

# 24 Slides--Functions - CS103 HO#24 Slides-Functions Closure...

This preview shows pages 1–3. Sign up to view the full content.

CS103 HO#24 Slides--Functions April 21, 2010 1 Closure The closure of a relation R on a set A with respect to a property P is the smallest relation containing R that has property P. R = {( , ), ( , ), . ..( ,)} A × A = {( , ), ( , ), . ..( ,), ( , ), ( , ), . ..( ,), ( , ), ( , ), . ..( ,)} Reflexive closure : add enough pairs to make the result reflexive The reflexive closure of R is the relation S = R {(x, x) | x A} Symmetric closure : add enough pairs to make the result symmetric The symmetric closure of R is the relation S = R R -1 = R {(y, x) | (x, y) R} Closure Transitive closure : add enough pairs to make the result transitive S = {(a, b) A × A | there is a path of any length from a to b in R} Closure Transitive closure : add enough pairs to make the result transitive S = {(a, b) A × A | there is a path of any length from a to b in R} S = R 1 R 2 R 3 R 4 ... R n where n is the number of elements in A Closure Transitive closure : add enough pairs to make the result transitive R* = {(a, b) A × A | there is a path of any length from a to b in R} R* = R 1 R 2 R 3 R 4 ... R n where n is the number of elements in A We don't need to go farther than R n . Since there are n elements in A, a path longer than n would contain a loop, which could be deleted. n + 1 hops Since there are only n elements in A, there must be a duplication, and a shorter path has already been found. SEA SFO DEN ORD IDC JFK ATL LA BOS SEA SFO DEN ORD IDC JFK ATL LA BOS R 1 R 2

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
CS103 HO#24 Slides--Functions April 21, 2010 2 SEA SFO DEN ORD IDC JFK ATL LA BOS R * : Transitive closure KB In a movie with Kevin Bacon In a movie with someone who was in a movie with Kevin Bacon You Your friends Friends of your friends Modeling Social Networks Functions Suppose that after curving, we use the final numeric averages to assign letter grades from the set {A, B, C, D, NP}. We would say that the grade assignment scheme gives us a mapping from number grades to letter grades, and that we have a function that maps numbers to grades. 95 88 74 92 87 A B C D NP Functions A function f is a mapping from a set D to a set T with the property that for each element d in D, the function f maps d to a single element of T, denoted f(d).
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 6

24 Slides--Functions - CS103 HO#24 Slides-Functions Closure...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online