当前位置:网站首页>[set theory] relational representation (relational matrix | examples of relational matrix | properties of relational matrix | operations of relational matrix | relational graph | examples of relationa
[set theory] relational representation (relational matrix | examples of relational matrix | properties of relational matrix | operations of relational matrix | relational graph | examples of relationa
2022-07-03 04:37:00 【Programmer community】
List of articles
- One 、 The relational matrix
- Two 、 Example of relational matrix
- 3、 ... and 、 Properties of relation matrix
- Four 、 Relational matrix operation
- 5、 ... and 、 The diagram
- 6、 ... and 、 Diagram example
- 7、 ... and 、 Relationships represent related properties
One 、 The relational matrix
A
=
{
a
1
,
a
2
,
⋯
,
a
n
}
,
R
⊆
A
×
A
A = \{ a_1, a_2 , \cdots , a_n \} , R \subseteq A \times A
A={ a1,a2,⋯,an},R⊆A×A
R
R
R Use The relational matrix Express :
M
(
R
)
=
(
r
i
j
)
n
×
n
M(R) = (r_{ij})_{n\times n}
M(R)=(rij)n×n
Relation matrix value :
M
(
R
)
(
i
,
j
)
=
r
i
j
=
{
1
,
a
i
R
a
j
0
,
nothing
Turn off
system
M(R)(i, j) = r_{ij} =\begin{cases} 1, & a_i R a_j \\ 0, & It doesn't matter \end{cases}
M(R)(i,j)=rij={ 1,0,aiRaj nothing Turn off system
Description of relation matrix definition :
A
A
A It's a
n
n
n Meta set ( There are
n
n
n Elements ) ,
R
R
R yes
A
A
A The binary relationship on ,
R
R
R The relation matrix of is
n
×
n
n \times n
n×n Matrix of , The first
i
i
i Xing di
j
j
j Element at column position
r
i
j
r_{ij}
rij The value can only be
0
0
0 or
1
1
1 ;
Description of relation matrix value :
If
r
i
j
=
1
r_{ij} = 1
rij=1 , shows
A
A
A Collection The first
i
i
i Elements and
j
j
j Elements have relationships
R
R
R , Write it down as :
a
i
R
a
j
a_i R a_j
aiRaj ;
If
r
i
j
=
0
r_{ij} = 0
rij=0 , shows
A
A
A Collection The first
i
i
i Elements and
j
j
j Elements don't matter
R
R
R ;
The essence of relational matrix : In the relation matrix , Each line corresponds to
A
A
A The elements in the collection , Each column also corresponds to
A
A
A The elements in the collection , The value of the position where the rows intersect (
0
0
0 or
1
1
1 ) Express
A
A
A In the set
i
i
i Elements and
j
j
j Whether there is a relationship between the ordered pairs of elements
R
R
R ;
Two 、 Example of relational matrix
A
=
{
a
,
b
,
c
}
A = \{ a, b, c \}
A={ a,b,c}
R
1
=
{
<
a
,
a
>
,
<
a
,
b
>
,
<
b
,
a
>
,
<
b
,
c
>
}
R_1 = \{ <a, a>, <a,b> , <b,a> , <b,c> \}
R1={ <a,a>,<a,b>,<b,a>,<b,c>}
R
2
=
{
<
a
,
b
>
,
<
a
,
c
>
,
<
b
,
c
>
}
R_2 = \{ <a,b> , <a,c> , <b,c> \}
R2={ <a,b>,<a,c>,<b,c>}
Use the relation matrix to express the above
R
1
,
R
2
R_1 , R_2
R1,R2 Two relationships :
R
1
=
{
<
a
,
a
>
,
<
a
,
b
>
,
<
b
,
a
>
,
<
b
,
c
>
}
R_1 = \{ <a, a>, <a,b> , <b,a> , <b,c> \}
R1={ <a,a>,<a,b>,<b,a>,<b,c>} among :
<
a
,
a
>
<a, a>
<a,a> :
a
a
a It's No
1
1
1 Elements ,
a
a
a It's No
1
1
1 Elements , The first
1
1
1 Xing di
1
1
1 The column elements are
1
1
1
<
a
,
b
>
<a, b>
<a,b> :
a
a
a It's No
1
1
1 Elements ,
b
b
b It's No
2
2
2 Elements , The first
1
1
1 Xing di
2
2
2 The column elements are
1
1
1
<
b
,
a
>
<b, a>
<b,a> :
b
b
b It's No
2
2
2 Elements ,
a
a
a It's No
1
1
1 Elements , The first
2
2
2 Xing di
1
1
1 The column elements are
1
1
1
<
b
,
c
>
<b, c>
<b,c> :
b
b
b It's No
2
2
2 Elements ,
c
c
c It's No
3
3
3 Elements , The first
2
2
2 Xing di
3
3
3 The column elements are
1
1
1
- The rest are all
0
0
0
M
(
R
1
)
=
[
1
1
0
1
0
1
0
0
0
]
M(R_1) = \begin{bmatrix} 1 & 1 & 0 \\\\ 1 & 0 & 1 \\\\ 0 & 0 & 0 \end{bmatrix}
M(R1)=⎣⎢⎢⎢⎢⎡110100010⎦⎥⎥⎥⎥⎤
R
2
=
{
<
a
,
b
>
,
<
a
,
c
>
,
<
b
,
c
>
}
R_2 = \{ <a,b> , <a,c> , <b,c> \}
R2={ <a,b>,<a,c>,<b,c>} among :
<
a
,
b
>
<a, b>
<a,b> :
a
a
a It's No
1
1
1 Elements ,
b
b
b It's No
2
2
2 Elements , The first
1
1
1 Xing di
2
2
2 The column elements are
1
1
1
<
a
,
c
>
<a, c>
<a,c> :
a
a
a It's No
1
1
1 Elements ,
c
c
c It's No
3
3
3 Elements , The first
1
1
1 Xing di
3
3
3 The column elements are
1
1
1
<
b
,
c
>
<b, c>
<b,c> :
b
b
b It's No
2
2
2 Elements ,
c
c
c It's No
3
3
3 Elements , The first
2
2
2 Xing di
3
3
3 The column elements are
1
1
1
- The rest are all
0
0
0
M
(
R
2
)
=
[
0
1
1
0
0
1
0
0
0
]
M(R_2) = \begin{bmatrix} 0 & 1 & 1 \\\\ 0 & 0 & 1 \\\\ 0 & 0 & 0 \end{bmatrix}
M(R2)=⎣⎢⎢⎢⎢⎡000100110⎦⎥⎥⎥⎥⎤
3、 ... and 、 Properties of relation matrix
Ordered pair set expression And The relational matrix Can only be mutually determined
Property one : Inverse operation related properties
M
(
R
−
1
)
=
(
M
(
R
)
)
T
M(R^{-1}) = (M(R))^T
M(R−1)=(M(R))T
M
(
R
−
1
)
M(R^{-1})
M(R−1) The inverse of the relationship Of The relational matrix
And
(
M
(
R
)
)
T
(M(R))^T
(M(R))T The relational matrix Of The inverse
These two matrices are equal ;
Property two : Properties related to composition operation
M
(
R
1
∘
R
2
)
=
M
(
R
2
)
∙
M
(
R
1
)
M(R_1 \circ R_2) = M(R_2) \bullet M(R_1)
M(R1∘R2)=M(R2)∙M(R1)
∙
\bullet
∙ It's matrix Logical multiplication , Calculation matrix
r
i
j
r_{ij}
rij Value The first
i
i
i That's ok multiply The first
j
j
j Column , Bit by bit Logical multiplication , Then multiply the logic and the result is Logical addition ;
Above Logical multiplication uses
∧
\land
∧ operation , Logical addition uses
∨
\lor
∨ operation ;
Four 、 Relational matrix operation
A
=
{
a
,
b
,
c
}
A = \{ a, b, c \}
A={ a,b,c}
R
1
=
{
<
a
,
a
>
,
<
a
,
b
>
,
<
b
,
a
>
,
<
b
,
c
>
}
R_1 = \{ <a, a>, <a,b> , <b,a> , <b,c> \}
R1={ <a,a>,<a,b>,<b,a>,<b,c>}
R
2
=
{
<
a
,
b
>
,
<
a
,
c
>
,
<
b
,
c
>
}
R_2 = \{ <a,b> , <a,c> , <b,c> \}
R2={ <a,b>,<a,c>,<b,c>}
In the example above , Two relational matrices have been found ;
M
(
R
1
)
=
[
1
1
0
1
0
1
0
0
0
]
M(R_1) = \begin{bmatrix} 1 & 1 & 0 \\\\ 1 & 0 & 1 \\\\ 0 & 0 & 0 \end{bmatrix}
M(R1)=⎣⎢⎢⎢⎢⎡110100010⎦⎥⎥⎥⎥⎤ ,
M
(
R
2
)
=
[
0
1
1
0
0
1
0
0
0
]
M(R_2) = \begin{bmatrix} 0 & 1 & 1 \\\\ 0 & 0 & 1 \\\\ 0 & 0 & 0 \end{bmatrix}
M(R2)=⎣⎢⎢⎢⎢⎡000100110⎦⎥⎥⎥⎥⎤
1. seek
M
(
R
−
1
)
,
M
(
R
2
−
1
)
M(R^{-1}) , M(R_2^{-1})
M(R−1),M(R2−1)
Directly transpose the matrix , Can get Inverse relation matrix of relation ;
M
(
R
1
−
1
)
=
(
M
(
R
1
)
)
T
=
[
1
1
0
1
0
0
0
1
0
]
M(R_1^{-1}) = (M(R_1))^T = \begin{bmatrix} 1 & 1 & 0 \\\\ 1 & 0 & 0 \\\\ 0 & 1 & 0 \end{bmatrix}
M(R1−1)=(M(R1))T=⎣⎢⎢⎢⎢⎡110101000⎦⎥⎥⎥⎥⎤
M
(
R
2
−
1
)
=
(
M
(
R
2
)
)
T
=
[
0
0
0
1
0
0
1
1
0
]
M(R_2^{-1}) = (M(R_2))^T = \begin{bmatrix} 0 & 0 & 0 \\\\ 1 & 0 & 0 \\\\ 1 & 1 & 0 \end{bmatrix}
M(R2−1)=(M(R2))T=⎣⎢⎢⎢⎢⎡011001000⎦⎥⎥⎥⎥⎤
R
1
−
1
=
{
<
a
,
a
>
,
<
a
,
b
>
,
<
b
,
a
>
,
<
c
,
b
>
}
R_1^{-1} = \{ <a, a> , <a, b> , <b,a> , <c,b> \}
R1−1={ <a,a>,<a,b>,<b,a>,<c,b>}
R
2
−
1
=
{
<
b
,
a
>
,
<
c
,
a
>
,
<
c
,
b
>
}
R_2^{-1} = \{ <b, a> , <c,a> , <c,b> \}
R2−1={ <b,a>,<c,a>,<c,b>}
2. seek
M
(
R
1
∘
R
1
)
M( R_1 \circ R_1 )
M(R1∘R1)
M
(
R
1
∘
R
1
)
=
M
(
R
1
)
∙
M
(
R
1
)
M( R_1 \circ R_1 ) = M(R_1) \bullet M(R_1)
M(R1∘R1)=M(R1)∙M(R1)
Among them
∙
\bullet
∙ Is the logical multiplication of two matrices , Addition uses
∨
\lor
∨ , Multiplication uses
∧
\land
∧
M
(
R
1
)
∙
M
(
R
1
)
=
[
1
1
0
1
0
1
0
0
0
]
∙
[
1
1
0
1
0
1
0
0
0
]
=
[
1
1
1
1
1
0
0
0
0
]
M(R_1) \bullet M(R_1) = \begin{bmatrix} 1 & 1 & 0 \\\\ 1 & 0 & 1 \\\\ 0 & 0 & 0 \end{bmatrix} \bullet \begin{bmatrix} 1 & 1 & 0 \\\\ 1 & 0 & 1 \\\\ 0 & 0 & 0 \end{bmatrix} = \begin{bmatrix} 1 & 1 & 1 \\\\ 1 & 1 & 0 \\\\ 0 & 0 & 0 \end{bmatrix}
M(R1)∙M(R1)=⎣⎢⎢⎢⎢⎡110100010⎦⎥⎥⎥⎥⎤∙⎣⎢⎢⎢⎢⎡110100010⎦⎥⎥⎥⎥⎤=⎣⎢⎢⎢⎢⎡110110100⎦⎥⎥⎥⎥⎤
Logical multiplication of matrices : The second of the result matrix
i
i
i That's ok , The first
j
j
j The value of the column element is , The first
i
i
i The three elements of a row Respectively with the previous
j
j
j The three elements of the column , Then the three results are or calculated , The end result is The order of the matrix
i
i
i That's ok , The first
j
j
j Value of column element ;
R
1
∘
R
1
=
{
<
a
,
a
>
,
<
a
,
b
>
,
<
a
,
c
>
,
<
b
,
a
>
,
<
b
,
b
>
}
R_1 \circ R_1 = \{ <a,a> , <a,b> , <a,c> , <b,a>, <b,b> \}
R1∘R1={ <a,a>,<a,b>,<a,c>,<b,a>,<b,b>}
3. seek
M
(
R
1
∘
R
2
)
M( R_1 \circ R_2 )
M(R1∘R2)
M
(
R
1
∘
R
2
)
=
M
(
R
2
)
∙
M
(
R
1
)
M( R_1 \circ R_2 ) = M(R_2) \bullet M(R_1)
M(R1∘R2)=M(R2)∙M(R1)
Among them
∙
\bullet
∙ Is the logical multiplication of two matrices , Addition uses
∨
\lor
∨ , Multiplication uses
∧
\land
∧
Particular attention , The order of synthesis is reverse synthesis , The latter relation matrix comes first , The former relation matrix is later
M
(
R
1
)
∙
M
(
R
2
)
=
[
0
1
1
0
0
1
0
0
0
]
∙
[
1
1
0
1
0
1
0
0
0
]
=
[
1
0
1
0
0
0
0
0
0
]
M(R_1) \bullet M(R_2) =\begin{bmatrix} 0 & 1 & 1 \\\\ 0 & 0 & 1 \\\\ 0 & 0 & 0 \end{bmatrix} \bullet \begin{bmatrix} 1 & 1 & 0 \\\\ 1 & 0 & 1 \\\\ 0 & 0 & 0 \end{bmatrix} = \begin{bmatrix} 1 & 0 & 1 \\\\ 0 & 0 & 0 \\\\ 0 & 0 & 0 \end{bmatrix}
M(R1)∙M(R2)=⎣⎢⎢⎢⎢⎡000100110⎦⎥⎥⎥⎥⎤∙⎣⎢⎢⎢⎢⎡110100010⎦⎥⎥⎥⎥⎤=⎣⎢⎢⎢⎢⎡100000100⎦⎥⎥⎥⎥⎤
Logical multiplication of matrices : The second of the result matrix
i
i
i That's ok , The first
j
j
j The value of the column element is , The first
i
i
i The three elements of a row Respectively with the previous
j
j
j The three elements of the column , Then the three results are or calculated , The end result is The order of the matrix
i
i
i That's ok , The first
j
j
j Value of column element ;
R
1
∘
R
2
=
{
<
a
,
a
>
,
<
a
,
c
>
}
R_1 \circ R_2 = \{ <a,a>, <a,c> \}
R1∘R2={ <a,a>,<a,c>}
5、 ... and 、 The diagram
A
=
{
a
1
,
a
2
,
⋯
,
a
n
}
,
R
⊆
A
×
A
A = \{ a_1, a_2 , \cdots , a_n \} , R \subseteq A \times A
A={ a1,a2,⋯,an},R⊆A×A
R
R
R Diagram for :
- The vertices :
∘
\circ
∘ Express
A
A
A The elements in the collection ;
- There is a directional side :
→
\rightarrow
→ Express
R
R
R The elements in ;
a
i
R
a
j
a_i R a_j
aiRaj It's from the apex
a
i
a_i
ai To The vertices
a
j
a_j
aj The directed side of
<
a
i
,
a
j
>
<a_i , a_j>
<ai,aj> ;
6、 ... and 、 Diagram example
A
=
{
a
,
b
,
c
}
A = \{ a, b, c \}
A={ a,b,c}
R
1
=
{
<
a
,
a
>
,
<
a
,
b
>
,
<
b
,
a
>
,
<
b
,
c
>
}
R_1 = \{ <a, a> , <a,b> , <b,a> , <b,c> \}
R1={ <a,a>,<a,b>,<b,a>,<b,c>} Diagram representation :
R
2
=
{
<
a
,
b
>
,
<
a
,
c
>
,
<
b
,
c
>
}
R_2 = \{ <a,b>, <a,c>, <b,c> \}
R2={ <a,b>,<a,c>,<b,c>} Use diagrams to represent :
R
1
−
1
=
{
<
a
,
a
>
,
<
a
,
b
>
,
<
b
,
a
>
,
<
c
,
b
>
}
R_1^{-1} = \{ <a,a>, <a,b>, <b,a> , <c,b> \}
R1−1={ <a,a>,<a,b>,<b,a>,<c,b>}
R
2
−
1
=
{
<
b
,
a
>
,
<
c
,
a
>
,
<
c
,
b
>
}
R_2^{-1} = \{ <b,a> , <c,a> , <c,b> \}
R2−1={ <b,a>,<c,a>,<c,b>}
7、 ... and 、 Relationships represent related properties
A
A
A The elements in the collection , After calibration sequence , That is, the
A
A
A Relationship on ,
R
⊆
A
×
A
R \subseteq A \times A
R⊆A×A , It has the following properties :
- The diagram
G
(
R
)
G(R)
R
R
R Set expression of ( Ordered pair set ) , Sure Sole determination ;
G(R) And Relational
- Relationship
R
R
R Set expression of , The relational matrix
M
(
R
)
M(R)
M(R) , The diagram
G
(
R
)
G(R)
G(R) , They all correspond to each other ;
R
⊆
A
×
B
R \subseteq A \times B
R⊆A×B
- aggregate
A
A
A There is
n
n
n Elements ,
∣
A
∣
=
n
|A| = n
∣A∣=n
- aggregate
B
B
B There is
m
m
m Elements ,
∣
B
∣
=
m
|B| = m
∣B∣=m
- The relational matrix
M
(
R
)
M(R)
M(R) yes
n
×
m
n \times m
n×m Order matrix ;
- The diagram
G
(
R
)
G(R)
G(R) All directional edges are from
A
A
A The elements in the collection Point to
B
B
B The elements in the collection
边栏推荐
- What's wrong with SD card data damage? How to recover SD card data damage
- Reptile exercise 03
- Why should programmers learn microservice architecture if they want to enter a large factory?
- [set theory] Cartesian product (concept of Cartesian product | examples of Cartesian product | properties of Cartesian product | non commutativity | non associativity | distribution law | ordered pair
- 联发科技2023届提前批IC笔试(题目)
- Contents of welder (primary) examination and welder (primary) examination in 2022
- RSRS指标择时及大小盘轮动
- [pat (basic level) practice] - [simple simulation] 1063 calculate the spectral radius
- Small sample target detection network with attention RPN and multi relationship detector (provide source code, data and download)
- After job hopping at the end of the year, I interviewed more than 30 companies in two weeks and finally landed
猜你喜欢
Leetcode simple question: check whether the array is sorted and rotated
After reviewing MySQL for a month, I was stunned when the interviewer of Alibaba asked me
Use the benchmarksql tool to perform a data prompt on kingbases. The jdbc driver cannot be found
arthas watch 抓取入参的某个字段/属性
When using the benchmarksql tool to preheat data for kingbasees, execute: select sys_ Prewarm ('ndx_oorder_2 ') error
P35-P41 fourth_ context
Prefix and (continuously updated)
Learning practice: comprehensive application of cycle and branch structure (I)
【XSS绕过-防护策略】理解防护策略,更好的绕过
Sdl2 + OpenGL glsl practice (Continued)
随机推荐
Web security - CSRF (token)
普通本科大学生活避坑指南
data2vec! New milestone of unified mode
Design and implementation of JSP logistics center storage information management system
4 years of experience to interview test development, 10 minutes to end, ask too
Ffmpeg mix
Sdl2 + OpenGL glsl practice (Continued)
Truncated sentences of leetcode simple questions
Golang -- realize file transfer
2022 a special equipment related management (elevator) analysis and a special equipment related management (elevator) simulation test
[dynamic programming] subsequence problem
Why should programmers learn microservice architecture if they want to enter a large factory?
金仓数据库KingbaseES 插件kdb_database_link
SSM based campus part-time platform for College Students
2.14 summary
FFMpeg example
商城系统搭建完成后需要设置哪些功能
BMZCTF simple_ pop
[fxcg] inflation differences will still lead to the differentiation of monetary policies in various countries
金仓数据库KingbaseES 插件kdb_date_function