当前位置:网站首页>[set theory] relational closure (relational closure solution | relational graph closure | relational matrix closure | closure operation and relational properties | closure compound operation)
[set theory] relational closure (relational closure solution | relational graph closure | relational matrix closure | closure operation and relational properties | closure compound operation)
2022-07-03 06:11:00 【Programmer community】
List of articles
- One 、 Closure method
- Two 、 Find an example of closure ( Diagram angle )
- 3、 ... and 、 Find an example of closure ( Relationship matrix angle )
- Four 、 Closure operation and relation properties
- 5、 ... and 、 Closure compound operation
One 、 Closure method
R
R
R The relationship is
A
A
A Binary relations on sets ,
R
⊆
A
R \subseteq A
R⊆A , And
A
A
A Set is not empty ,
A
≠
∅
A \not= \varnothing
A=∅
Find reflexive closure :
r
(
R
)
=
R
∪
I
A
r(R) = R \cup I_A
r(R)=R∪IA , Add a ring to each vertex ;
- If
R
R
R Relationships are reflexive , If and only if ,
I
A
⊆
R
I_A \subseteq R
IA⊆R
Find symmetric closure :
s
(
R
)
=
R
∪
R
−
1
s(R) = R \cup R^{-1}
s(R)=R∪R−1
- original There is no edge ( Ordered pair ) , Naturally, there is no corresponding inverse , Do not add edges at this time
- original There is a directed side ( Ordered pair ) , Add a reverse directed edge , form In the diagram Between vertices Two way directed edge
- original There are two directed edges ( Ordered pair ) , At this time, there is no need to add other edges
- If
R
R
R The relationship is symmetrical , If and only if ,
R
=
R
−
1
R = R^{-1}
R=R−1
Finding transitive closure :
t
(
R
)
=
R
∪
R
2
∪
R
3
∪
⋯
t(R) = R \cup R^2 \cup R^3 \cup \cdots
t(R)=R∪R2∪R3∪⋯
take
R
R
R Relate all the power operation values together , Is its transitive closure ,
R
R
R Relational
1
1
1 The next power ,
R
R
R Relational
2
2
2 The next power ,
R
R
R Relational
3
3
3 The next power ,
⋯
\cdots
⋯ ,
R
R
R Relational
n
n
n The next power , And get up , Is its transitive closure ;
If
A
A
A It's a poor set , The relationship is also poor , Find out all
n
n
n The next power , There is no need to find many power operations , Because the power operation of the relationship is followed by a cycle , Find all known
n
n
n The next power take Union is enough ;
If
R
R
R Relationships are transitive , If and only if ,
R
2
⊆
R
R^2 \subseteq R
R2⊆R
Two 、 Find an example of closure ( Diagram angle )
aggregate
A
=
{
a
,
b
,
c
,
d
}
A = \{ a, b, c , d \}
A={ a,b,c,d}
Relationship
R
=
{
<
a
,
b
>
,
<
b
,
a
>
,
<
b
,
c
>
,
<
c
,
d
>
}
R = \{ <a,b> , <b,a> , <b,c> , <c,d> \}
R={ <a,b>,<b,a>,<b,c>,<c,d>}
Seeking relationship
R
R
R Reflexive closure of
r
(
R
)
r(R)
r(R) , Symmetric closure
s
(
R
)
s(R)
s(R) , Pass closures
t
(
R
)
t(R)
t(R)

Find reflexive closure : Is to add a ring to each vertex :

Find symmetric closure : take Between vertices Change one-way edge to two-way edge , No matter Two way edges between vertices and There are no edges between vertices The situation of ;

Finding transitive closure : Connect the accessible points directly ;
- a You can go to b , route a -> b ; a You can go to c , The path is a a -> b -> c ; a You can go to d , The path is a a -> b -> c -> d ; So add a To c , d The directed side of ;
- b You can go to a , route b -> a ; b You can go to c , The path is a b -> c ; b You can go to d , The path is a b -> c -> d ; So add b To d The directed side of ;
- c You can go to d , route c -> d ; There are no connectable edges ;
- d I can't get anywhere , There are no connectable edges ;
- In addition, when two-way edges appear , Two vertices must be looped ;

3、 ... and 、 Find an example of closure ( Relationship matrix angle )
Relationship
R
=
{
<
a
,
b
>
,
<
b
,
a
>
,
<
b
,
c
>
,
<
c
,
d
>
}
R = \{ <a, b> , <b,a> , <b,c> , <c,d> \}
R={ <a,b>,<b,a>,<b,c>,<c,d>}
Use the relation matrix method to find its Reflexive closure , Symmetric closure , Pass closures ;
Write the above relationship in matrix form as :
M
(
R
)
=
[
0
1
0
0
1
0
1
0
0
0
0
1
0
0
0
0
]
M(R) = \begin{bmatrix} 0 & 1 & 0 & 0 \\\\ 1 & 0 & 1 & 0 \\\\ 0 & 0 & 0 & 1 \\\\ 0 & 0 & 0 & 0 \end{bmatrix}
M(R)=⎣⎢⎢⎢⎢⎢⎢⎢⎢⎡0100100001000010⎦⎥⎥⎥⎥⎥⎥⎥⎥⎤
Reflexive closure : Set the main diagonal value , All changed
1
1
1 , The upper left corner to the lower right corner is the main diagonal ;
M
(
r
(
R
)
)
=
[
1
1
0
0
1
1
1
0
0
0
1
1
0
0
0
1
]
M(r(R)) = \begin{bmatrix} 1 & 1 & 0 & 0 \\\\ 1 & 1 & 1 & 0 \\\\ 0 & 0 & 1 & 1 \\\\ 0 & 0 & 0 & 1 \end{bmatrix}
M(r(R))=⎣⎢⎢⎢⎢⎢⎢⎢⎢⎡1100110001100011⎦⎥⎥⎥⎥⎥⎥⎥⎥⎤
Symmetric closure : Both ends of the main diagonal should be symmetrical , Based on the diagonal , Make the values on both sides of the diagonal symmetrical ;
M
(
s
(
R
)
)
=
[
0
1
0
0
1
0
1
0
0
1
0
1
0
0
1
0
]
M(s(R)) = \begin{bmatrix} 0 & 1 & 0 & 0 \\\\ 1 & 0 & 1 & 0 \\\\ 0 & 1 & 0 & 1 \\\\ 0 & 0 & 1 & 0 \end{bmatrix}
M(s(R))=⎣⎢⎢⎢⎢⎢⎢⎢⎢⎡0100101001010010⎦⎥⎥⎥⎥⎥⎥⎥⎥⎤
Pass closures : Find the of the relation matrix second power , third power , fourth power ,
⋯
\cdots
⋯ , Until the value of the same cycle appears ;
Put all the above different Matrix power operation Add logically ( or ) operation , Is the matrix corresponding to its transitive closure , Computer algorithm is suitable for this method , If people calculate , The diagram is more vivid ;
Reference resources : 【 Set theory 】 Relationship means ( The relational matrix | Example of relational matrix | Properties of relation matrix | Relational matrix operation | The diagram | Diagram example | Relationships represent related properties ) Four 、 Relational matrix operation
Pay attention to reverse order synthesis
M
(
R
2
)
=
M
(
R
∘
R
)
=
M
(
R
)
∙
M
(
R
)
=
[
0
1
0
0
1
0
1
0
0
0
0
1
0
0
0
0
]
∙
[
0
1
0
0
1
0
1
0
0
0
0
1
0
0
0
0
]
=
[
1
0
1
0
0
1
0
1
0
0
0
0
0
0
0
0
]
M(R^2) = M(R \circ R) = M(R) \bullet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R)∙M(R2)=⎣⎢⎢⎢⎢⎢⎢⎢⎢⎡0100100001000010⎦⎥⎥⎥⎥⎥⎥⎥⎥⎤∙⎣⎢⎢⎢⎢⎢⎢⎢⎢⎡1000010010000100⎦⎥⎥⎥⎥⎥⎥⎥⎥⎤=⎣⎢⎢⎢⎢⎢⎢⎢⎢⎡0100100001001000⎦⎥⎥⎥⎥⎥⎥⎥⎥⎤
M
(
R
4
)
=
M
(
R
3
∘
R
)
=
M
(
R
)
∙
M
(
R
3
)
=
[
0
1
0
0
1
0
1
0
0
0
0
1
0
0
0
0
]
∙
[
0
1
0
1
1
0
1
0
0
0
0
0
0
0
0
0
]
=
[
1
0
1
0
0
1
0
1
0
0
0
0
0
0
0
0
]
=
M
(
R
2
)
M(R^4) = M(R^3 \circ R) = M(R) \bullet M(R^3) =\begin{bmatrix} 0 & 1 & 0 & 0 \\\\ 1 & 0 & 1 & 0 \\\\ 0 & 0 & 0 & 1 \\\\ 0 & 0 & 0 & 0 \end{bmatrix} \bullet \begin{bmatrix} 0 & 1 & 0 & 1 \\\\ 1 & 0 & 1 & 0 \\\\ 0 & 0 & 0 & 0 \\\\ 0 & 0 & 0 & 0 \end{bmatrix} = \begin{bmatrix} 1 & 0 & 1 & 0 \\\\ 0 & 1 & 0 & 1 \\\\ 0 & 0 & 0 & 0 \\\\ 0 & 0 & 0 & 0 \end{bmatrix} = M(R^2)
M(R4)=M(R3∘R)=M(R)∙M(R3)=⎣⎢⎢⎢⎢⎢⎢⎢⎢⎡0100100001000010⎦⎥⎥⎥⎥⎥⎥⎥⎥⎤∙⎣⎢⎢⎢⎢⎢⎢⎢⎢⎡0100100001001000⎦⎥⎥⎥⎥⎥⎥⎥⎥⎤=⎣⎢⎢⎢⎢⎢⎢⎢⎢⎡1000010010000100⎦⎥⎥⎥⎥⎥⎥⎥⎥⎤=M(R2)
Therefore, its
R
4
R^4
R4 The subsequent power operation value , Even power relation matrix and
M
(
R
2
)
M(R^2)
M(R2) Same value , Odd power relation matrix and
M
(
R
3
)
M(R^3)
M(R3) Same value ;
M
(
t
(
R
)
)
=
M
(
R
)
∨
M
(
R
2
)
∨
M
(
R
3
)
=
[
1
1
1
1
1
1
1
1
0
0
0
0
0
0
0
0
]
M(t(R)) = M(R) \lor M(R^2) \lor M(R^3) =\begin{bmatrix} 1 & 1 & 1 & 1 \\\\ 1 & 1 & 1 & 1 \\\\ 0 & 0 & 0 & 0 \\\\ 0 & 0 & 0 & 0 \end{bmatrix}
M(t(R))=M(R)∨M(R2)∨M(R3)=⎣⎢⎢⎢⎢⎢⎢⎢⎢⎡1100110011001100⎦⎥⎥⎥⎥⎥⎥⎥⎥⎤
Four 、 Closure operation and relation properties
| reflexivity | symmetry | Transitivity | |
|---|---|---|---|
r ( R ) r(R) r(R) | 1 1 1 ( Nature of itself ) | 1 1 1 | 1 1 1 |
r ( R ) r(R) r(R) | 1 1 1 | 1 1 1 ( Nature of itself ) | |
r ( R ) r(R) r(R) | 1 1 1 | 1 1 1 | 1 1 1 ( Nature of itself ) |
The median value in the above table is
1
1
1 , It shows that this property originally exists , Find the corresponding introspect / symmetry / Pass on After closure , It still has this property , On the contrary, it does not have this property ;
The meaning of the second row of the table :
r
(
R
)
r(R)
r(R) The corresponding line ;
- reflexivity : If
R
R
R It turned out to be reflexive , that
r
(
R
)
r(R)
r(R) It's also reflexive ;
- symmetry : If
R
R
R It turns out to be symmetrical , that
r
(
R
)
r(R)
r(R) It's also symmetrical ; Find reflexive closure , Just ring the vertex , Does not affect symmetry ;
- Transitivity : If
R
R
R It was transmitted , that
r
(
R
)
r(R)
r(R) It is also transmitted ; Find reflexive closure , Just ring the vertex , Does not affect transmissibility ;
There is only one exception : original
R
R
R It's delivered , If we find symmetric closures , The transitivity of its symmetric closure does not exist ;
Description of the second column of the table ( reflexivity ) : If
R
R
R Relationships are reflexive , So Symmetric closure
s
(
R
)
s(R)
s(R) and Pass closures
t
(
R
)
t(R)
t(R) It's also reflexive ;
R
since
back
⇒
s
(
R
)
and
t
(
R
)
since
back
R introspect \Rightarrow s(R) and t(R) introspect
R since back ⇒s(R) and t(R) since back
The third column of the table explains ( symmetry ) : If
R
R
R The relationship is symmetrical , So Reflexive closure
r
(
R
)
r(R)
r(R) and Pass closures
t
(
R
)
t(R)
t(R) It's also symmetrical ;
R
Yes
call
⇒
r
(
R
)
and
t
(
R
)
Yes
call
R symmetry \Rightarrow r(R) and t(R) symmetry
R Yes call ⇒r(R) and t(R) Yes call
The fourth column of the table explains ( Transitivity ) : If
R
R
R Relationships are transitive , So Reflexive closure
r
(
R
)
r(R)
r(R) It is also transmitted ;
R
Pass on
Deliver
⇒
r
(
R
)
Pass on
Deliver
R Pass on \Rightarrow r(R) Pass on
R Pass on Deliver ⇒r(R) Pass on Deliver
5、 ... and 、 Closure compound operation
R
R
R The relationship is
A
A
A Binary relations on sets ,
R
⊆
A
R \subseteq A
R⊆A , And
A
A
A Set is not empty ,
A
≠
∅
A \not= \varnothing
A=∅
1.
r
s
(
R
)
=
s
r
(
R
)
rs(R) = sr(R)
rs(R)=sr(R) :
- rs( R ) : First seek
R
R
R Relational Reflexive closure , Then find the reflexive closure Symmetric closure
- sr( R ) : First seek
R
R
R Symmetric closure of relation , Then find the reflexive closure of symmetric closure
- The above two closure operations The result is the same
2.
r
t
(
R
)
=
t
r
(
R
)
rt(R) = tr(R)
rt(R)=tr(R)
- rt( R ) : First seek
R
R
R Relational Reflexive closure , Then find the reflexive closure Pass closures
- tr( R ) : First seek
R
R
R Transitive closure of relation , Then find the reflexive closure of transitive closure
- The above two closure operations The result is the same
3.
s
t
(
R
)
⊆
t
s
(
R
)
st(R) \subseteq ts(R)
st(R)⊆ts(R)
- st( R ) : First seek
R
R
R Relational Symmetric closure , Then find the symmetric closure Pass closures
- ts( R ) : First seek
R
R
R Transitive closure of relation , Then find the symmetric closure of transitive closure
- The results of the above two closure operations ,
t
s
(
R
)
ts(R)
ts(R) Relationship contain
s
t
(
R
)
st(R)
st(R) Relationship ;
边栏推荐
- Mysql database table export and import with binary
- Multithreading and high concurrency (7) -- from reentrantlock to AQS source code (20000 words, one understanding AQS)
- SVN分支管理
- Kubesphere - build Nacos cluster
- The programmer shell with a monthly salary of more than 10000 becomes a grammar skill for secondary school. Do you often use it!!!
- Understand the first prediction stage of yolov1
- Analysis of Clickhouse mergetree principle
- Solve the problem of automatic disconnection of SecureCRT timeout connection
- MySQL帶二進制的庫錶導出導入
- pytorch 搭建神经网络最简版
猜你喜欢
![[teacher Zhao Yuqiang] redis's slow query log](/img/a7/2140744ebad9f1dc0a609254cc618e.jpg)
[teacher Zhao Yuqiang] redis's slow query log

Project summary --2 (basic use of jsup)

GPS坐标转百度地图坐标的方法
![[teacher Zhao Yuqiang] use the catalog database of Oracle](/img/0b/73a7d12caf955dff17480a907234ad.jpg)
[teacher Zhao Yuqiang] use the catalog database of Oracle

Bio, NiO, AIO details

Merge and migrate data from small data volume, sub database and sub table Mysql to tidb
![[system design] proximity service](/img/4a/2e68536cbe385af1d1a591e674fbf0.png)
[system design] proximity service

Kubernetes notes (VII) kuberetes scheduling

Clickhouse learning notes (2): execution plan, table creation optimization, syntax optimization rules, query optimization, data consistency

Core principles and source code analysis of disruptor
随机推荐
[teacher Zhao Yuqiang] Alibaba cloud big data ACP certified Alibaba big data product system
In depth analysis of kubernetes controller runtime
Understand expectations (mean / estimate) and variances
Deep learning, thinking from one dimensional input to multi-dimensional feature input
Clickhouse learning notes (I): Clickhouse installation, data type, table engine, SQL operation
Installation du plug - in CAD et chargement automatique DLL, Arx
Clickhouse learning notes (2): execution plan, table creation optimization, syntax optimization rules, query optimization, data consistency
BeanDefinitionRegistryPostProcessor
JDBC connection database steps
. Net program configuration file operation (INI, CFG, config)
ODL framework project construction trial -demo
CAD插件的安裝和自動加載dll、arx
Cesium 点击获取模型表面经纬度高程坐标(三维坐标)
Tabbar settings
[teacher Zhao Yuqiang] use Oracle's tracking file
Solve the problem of automatic disconnection of SecureCRT timeout connection
1. 兩數之和
Yum is too slow to bear? That's because you didn't do it
Migrate data from Amazon aurora to tidb
[video of Teacher Zhao Yuqiang's speech on wot] redis high performance cache and persistence