0% found this document useful (0 votes)
22 views22 pages

Chapter9 4

Uploaded by

15985720860
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views22 pages

Chapter9 4

Uploaded by

15985720860
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 22

§9.

4 Closures of Relations ( 关系的闭包 )


1. Introduction
(1) Example 0 (page 597)
A computer network has data centers
in Boston, Chicago, Denver, Detroit,
New York and San Diego. There are
direct, one-way telephone lines from
Boston to Chicago, from Boston to
Detroit, from Chicago to Detroit, from
Detroit to Denver, and from New York
to San Diego.
Let R be the relation containing (a,b) if there is
a telephone line from the data center a to that
in b. How can we determine if there is some
(possibly indirect) link composed one or
more telephone lines from one center to
another?
Solution:
We can find all pairs of data centers that
have a link by constructing the smallest
transitive relation that contains R.
This relation is called the transitive closure
( 传递闭包 ) of R
(2) The Closure of Relation R with
Respect to Property P
Let R be a relation on A. R may or
may not have some property P, such as
reflexive, symmetric, or transitivity.
If there is a relation S with property P
containing R such that S is a subset of
every relation with property P
containing R, then S is called the
closure of R with respect to P.
2. Closures
(1) Reflexive Closure
The relation R={(1,1), (1,2), (2,1), (3,2)}}
on the set A={1,2,3} is not reflexive.
How can we produce a reflexive
relation containing R that is as small as
possible?
Answer:
by adding (2,2), (3,3) to relation R.
The new relation is called the reflexive
closure of R.
(2) Result 1
Let ∆={ (a,a) | a∈A}. It is called the diagonal
relation ( 对角线的关系 ).
The reflexive closure of relation R on set
A------------------------ R∪∆

Example 1 (page 598)


What is the reflexive closure of the relation
R={ (a,b) | a<b } on the set of integers?
Solution:
R∪∆=…………={ (a,b) | a≤b }
(3) Symmetric Closure
The relation { (1,1), (1,2), (2,2), (2,3),
(3,1), (3,2) } on {1,2,3} is not symmetric.
How can we produce a symmetric
relation that is as small as possible and
contains R?
Answer:
by adding (2,1) and (1,3).
The new relation is called the symmetric
closure of R.
(4) Result 2
Let R-1={ (b,a) | (a,b)∈R }.
The symmetric closure of relation R is
R∪R-1
Example 2 (page 598)
What is the symmetric closure of the
relation R={ (a,b) | a>b } on the set of
positive integers?
Answer:
R∪R-1=……….={ (a,b) | a≠b }
S=R∪R-1
1)Prove S is symmetric
for any (a,b) ∈S, (a,b) ∈R∪R-1 there are two cases
i) (a,b) ∈R, then (b,a) ∈ R-1, (b,a) ∈S
ii)

2) R ⊆ S
obvious
S=R∪R-1

3) For any T, T is symmetric, R ⊆ T, we prove S ⊆ T.


(a,b) ∈S,
(a,b) ∈R∪R-1 { S=R∪R-1 }
i) (a,b) ∈R
(a,b) ∈T { R ⊆ T }
ii) (a,b) ∈R-1
(b,a) ∈R {def of R-1}
(b,a) ∈T { R ⊆ T }
(a,b) ∈T { T is symmetric}
(a,b) ∈T
S⊆T
(5) Transitive Closure
Consider the relation R={ (1,3), (1,4),
(2,1), (3,2) } on the set {1,2,3,4}.
The relation is not transitive.
Add (1,2), (2,3), (2,4), and (3,1).
Still not transitive.
Why? -------(3,1) in
-------(1,4) in
-------(3,4) not in
transitive closure----------complicated
3. Paths in directed graphs
(1) Definition 1 (path)
A path from a to b in the directed
graph G is a sequence of edges (x0,x1),
(x1,x2), (x2,x3),…,(xn-1,xn) in G, where n is
a nonnegative integer, and x0=a, xn=b.
This path is denoted by x0, x1, …, xn
and has length n.
A path of length n≥1 that begins and
ends at the same vertex is called a
circuit or cycle.
(2) Example 3 (page 599)
Which of the following are paths in the
directed graph shown in Figure 1:
a, b, e, d;
a, e, c, d, b;
b, a, c, b, a, a, b;
d, c;
c, b, a;
e, b, a, b, a, b, e?
What are the lengths
of those that are paths?
Which of the paths in this list are circuits?
(3) The term path also applies to
relations
There is a path from a to b in R if
there is a sequence of elements a, x1,
x2, …, xn-1, b with (a,x1)∈R,(x1,x2)∈R,…,
and (xn-1,b)∈R.
(4) Theorem 1 (page 600)
Let R be a relation on a set A. There
is a path of length n, where n is a
positive integer, from a to b if and only
if (a,b)∈Rn.
Can prove formally by induction (see
textbook).
(2) Example 4 (page 600)
Let R be the relation on the set of all
people in the world that contains (a,b) if
a has met b. What is Rn, where n is a
positive integer greater than one? What
is R*?
Answer:
(a) The relation R2 contains (a,b) if there
is a person c such that (a,c)∈R and
(c,b)∈R, that is, if there is a person c
such that a has met c and c has met b.
(b) Similarly, Rn consists of those pairs
(a,b) such that there are people x1, x2,
… , xn-1 such that a has met x1, x1 has
met x2, … , and xn-1 has met b.

(c) The relation R* contains (a,b) if there


is a sequence of people, starting with a
and ending with b, such that each
person in the sequence has met the
next person in the sequence.
(3) Theorem 2 (page 601)
The transitive closure of a relation R equals the connectivity relation R*.
Proof:
1) R* contains R by definition.
2) We show that R* is transitive. If (a,b) ∈ R* and (b,c) ∈ R*, then there are paths from a to b and from
b to c in R. We obtain a path from a to c by starting with the path from a to b and following it with the
path from b to c. Hence, (a, c) ∈ R*, namely R* is transitive.

• we must also show that R


• ∗ is transitive and that R
• ∗ ⊆ S whenever S is a transitive relation that
• contains R.
• First, we show that R
• ∗ is transitive. Now suppose that S is a transitive relation containing R. Because S is transitive, Sn also is
• transitive (the reader should verify this) and Sn ⊆ S (by Theorem 1 of Section 9.1). Furthermore,
• because
• S
• ∗=
• ∞

• k =1
• Sk
• and SkPlease see blackboard and book.
3) Now suppose that S is a transitive
relation containing R, R ⊆ S. Because S
is transitive, Sn⊆ S (by Theorem 1 of
Section 9.1). It follows that S*⊆S. From R
⊆ S, R*⊆ S*, because any path in R is
also a path in S. Consequently, R*⊆ S*
⊆S.
(4) Lemma 1 (page 601)
Let A be a set with n elements, and R
be a relation on A. If there is a path of
length at least one in R from a to b,
then there is a path with length not
exceeding n.
Moreover, when a≠b, if there is a path of
at least one in R from a to b, then there
is such a path with length not
exceeding n-1.
From Lemma 1, we see that the transitive
closure of R is the union of R, R2, R3, …,
Rn.
R*=R ∪R2 ∪R3 ∪… ∪Rn

You might also like