Relations and Digraphs
Sources:
- Bernard Kolman, Robert C. Busby & Sharon Cutler Ros. (2014). Relations and Digraph. Discrete Mathematical Structures (6th ed., pp. 139-204). Pearson.
Orderd pair and list
- List:
- Suppose 𝑛 is a nonnegative integer. A list of length 𝑛 is an ordered collection of 𝑛 elements (which might be numbers, other lists, or more abstract objects).
- Note: A list has finite length since
is an integer.
- Note: A list has finite length since
- Two lists are equal if and only if they have the same length and the same elements in the same order.
- Suppose 𝑛 is a nonnegative integer. A list of length 𝑛 is an ordered collection of 𝑛 elements (which might be numbers, other lists, or more abstract objects).
- Ordered pair:
- An ordered pair
is a listing of the objects a and b in a prescribed order, with a appearing first and b appearing second. - Thus an ordered pair is merely a sequence of length 2.
- An ordered pair
Product Sets
If A and B are two nonempty sets, we define the product set or Cartesian product
Theorem:
For any two finite, nonempty sets
Proof:
Suppose that |A| = m and |B| = n. To form an ordered pair (a,b), a ∈ A and b ∈ B, 需要分别从A, B中选一个元素, 分别有m, n中可能, 因此
Example:
If
Partitions
A partition(划分) or quotient set(商集) of a nonempty set
- Each element of
belongs to one of the sets in . - If
and are distinct elements of , then .
即: 集合
The sets in
- Since the members of a partition of a set
are subsets of , we see that the partition is a subset of , the power set of . That is, partitions can be considered as particular kinds of subsets of . 集合A的划分是A的幂集的一个子集.
Example:
Let
Then
Also,
The collection
Example:
Let
Then
Relations
Let
If
If
Frequently,
Example:
Let
Example:
实数域的"等于"
Let
Example:
实数域的"小于"
Let
R = {(1,2),(1,3),(1,4),(1,5),(2,3),(2,4),(2,5),(3,4),(3,5),(4,5)}.
Sets Arising from Relations
Domain and Range
The domain of
, denoted by , is the set of elements in that are related to some element in .In other words,
, a subset of , is the set of all first elements in the pairs that make up .The range, or codomain of
, denoted by , is the set of elements in that are second elements of pairs in , that is, all elements in that are paired with some element in .Elements of
that are not in are not involved in the relation in any way. This is also true for elements of that are not in .
R-relative Set
-relative set(R相关集): If is a relation from A to B and , we define , the -relative set of , to be the set of all in with the property that is -related to . Thus, in symbols,Similarly, if
, then , the -relative set of , is the set of all in with the property that is -related to for some in . That is,Note that
can also be written as , but we choose the simpler notation.我们定义
is the union of the sets , where .- 当参数为元素
时, 表示 的 相关集. 当参数为集合 时, 表示 中每一个元素 的 相关集的union(并集).
- 当参数为元素
THEOREM1
Let
- If
, then . . .
Proof
If
,then for some . Since , . 因此在 中存在若干个 满足 , 即存在 . Thus, , 因此证明了(1).If
,then by definition for some in . If is in , then, since , we must have .By the same argument, if
is in , then . In either case, . Thus we have shown that .Conversely, since
, part (1) tells us that . Similarly, . Thus R(A_1) ∪ , and therefore part (2) is true.If
, then, for some in , . Since is in both and , it follows that y is in both and ; that is, . Thus part (3) holds.
THEOREM2
Let
Proof
If
由于每个
The Matrix of a Relation
We can represent a relation between two finite sets with a matrix as follows. If
The matrix
The Digraph of a Relation
Digraphs are nothing but geometrical representations of relations.
If
中的每个元素都是一个点(vertex)- 点
和 存在一条边(edge) iff .
The resulting pictorial representation of
可以看到,
Example:
Let
Then the digraph of
In-degree & Out-degree
If R is a relation on a set A and a ∈ A, then
- The in-degree(入度) of
(relative to the relation ) is the number of such that . - The out-degree(出度) of
is the number of such that .
在图像上, 一个vertex的in-degree代表指向该vertex的edge, 而out-degree代表从该vertex出发的edge.
- Note that the out-degree of
is .
Paths in Relations and Digraphs
A path is most easily visualized with the aid of the digraph of the relation. It appears as a geometric path or succession of edges in such a digraph.
Suppose that
A path of length
Note that a path of length
cycle(环): A path that begins and ends at the same vertex is called a cycle(环).
It is clear that the paths of length
can be identified with the ordered pairs that belong to . : If is a fixed positive integer, we define a relation on as follows: means that there is a path of length from to in . 即存在一条x -> y的长度为n的路径. consists of all vertices that can be reached from by means of a path in of length .
: The connectivity(连通性) relation of a relation on a set mean that if by letting , there is some path in from to . 也被称为connectivity(连通性). 即存在一条x -> y的长度未知的路径.- The set
consists of all vertices that can be reached from by some path in .
- The set
: The reachability(可达性) relation of a relation on a set that has elements is defined asfollows: means that or . The idea is that is reachable from if either is or there is some path from to . y到x是可达的 = 要么y就是x, 要么存在一条x -> y的长度未知的路径.- It is easily seen that
, where is the identity matrix.
- It is easily seen that
路径的组合:
Let
be a path in a relation of length from to , and let be a path in of length from to .Then the composition of
and π2 the path of length , which is denoted by . This is a path from to .即: 如果有一条长度为m的路径
: a -> ... -> b, 长度为n的路径 : b -> ... -> c. 则存在从a到c的路径a -> ... -> b -> ... -> c, 它是 和 的组合, 长度为m+n.
Theorem:
If
Proof:
Let
By definition of the matrix
翻译:
如果
这意味着:
- For brevity, we will usually denote
. simply as (the symbol reminds us that this is not the usual matrix product).
Theorem:
之前的结论可以推导到n>=2:
For
联系之前
Equivalence Relations
- equivalence relation(等价关系): A relation R on a set A is called an equivalence relation if it is reflexive, symmetric, and transitive. 即同时满足自反性, 对称性和传递性.
Example:
Let
Example:
Let
Equivalence Relations and Partitions
THEOREM 1: Equivalence Relation -> Partition
如果
Let
Then
Proof:
- If
, then clearly is in the same block as itself; so . 自反性. - If
, then and are in the same block; so . 如果 , 则a, b在同一个block内, 因此必定有 , 证明了对称性. - If
and , then , and must all lie in the same block of . Thus . 如果 , 则a, b在同一个block内, 同理b, c也在同一个block内, 因此a, b, c都在同一个block内, 因此有 . 证明了传递性.
因此
Since
THEOREM 2: Partition -> Equivalence Relation
反过来, 也可以用等价关系
Let
Then
Proof: According to the definition of a partition, we must show the following two properties:
- Every element of
belongs to some relative set(some ). - If
and are not identical, then .
由于
接着证明性质2的逆否命题:
To prove this, we assume that
Since
Then
Lemma1已经证明了
We have now proved that
Lemma1
Let
Proof
充分性: 假设
必要性:
假设
- 由于
是对称的, 所以有 . , 有 . 由于 是传递的, 并且已经有 , 所以有 , 也就是说: . 证明了 .- 反过来,
, 有 . 由于 是传递的, 并且已经有 , 所以有 , 也就是说: . 证明了 . - 综上所述,
.
Equivalence Class
equivalence class(等价类): If
- 这里的
指的是THEOREM2中的distinct relative set for in . 每个不同(distinct)的 就是一个等价类. - 划分
就是 的等价类构成的集合. 被表示为 . - 由于
也被称为A的商集(quotient set), the notation reminds us that is the quotient set of that is constructed from and determines . - Some authors denote the equivalence class
by .
Transitive Closure and Warshall's Algorithm
Transitive Closure
In this section we consider a construction that has several interpretations and many important applications. Suppose that R is a relation on a set A and that R is not transitive. We will show that the transitive closure of R (see Section 7) is just the connectivity relation