关系
关系 | |
---|---|
术语名称 | 关系 |
英语名称 | relation |
关系(relation)是描述两个或多个集合中元素之间的关联的数学对象。 不特殊说明的情况下,关系指两个集合之间的关系,即二元关系。
定义
对 [math]\displaystyle{ n }[/math] 个集合 [math]\displaystyle{ A_1, A_2, \dots, A_n }[/math] 有笛卡尔积 [math]\displaystyle{ A_1 \times A_2 \times \dots \times A_n }[/math] ,则其子集 [math]\displaystyle{ R \subseteq A_1 \times A_2 \times \dots \times A_n }[/math] 称为 [math]\displaystyle{ A_1, A_2, \dots, A_n }[/math] 上的一个 [math]\displaystyle{ n }[/math] 元关系(n-ary relation)。也就是说,关系 [math]\displaystyle{ R }[/math] 是 [math]\displaystyle{ n }[/math] 元组 [math]\displaystyle{ (a_1, a_2, \dots, a_n) }[/math] 的集合,其中 [math]\displaystyle{ a_i \in A_i }[/math] 。
关系一般用 R、S、……表示。
通常,如果不特别指出元数,关系是指二元关系。
二元关系
对集合 [math]\displaystyle{ A }[/math] 、 [math]\displaystyle{ B }[/math] 有笛卡尔积 [math]\displaystyle{ A \times B }[/math] ,则其子集 [math]\displaystyle{ R \subseteq A \times B }[/math] 称为 [math]\displaystyle{ A }[/math] 、 [math]\displaystyle{ B }[/math] 上的一个 二元关系(binary relation),简称关系(relation)。 也就是说,关系 [math]\displaystyle{ R }[/math] 是有序对 [math]\displaystyle{ (a, b) }[/math] 的集合,其中 [math]\displaystyle{ a \in A, b \in B }[/math] 。
两个集合上的关系也称为从 [math]\displaystyle{ A }[/math] 到 [math]\displaystyle{ B }[/math] 的二元关系。 反过来,对从 [math]\displaystyle{ A }[/math] 到 [math]\displaystyle{ B }[/math] 的二元关系 [math]\displaystyle{ R }[/math] , [math]\displaystyle{ A }[/math] 称为二元关系 [math]\displaystyle{ R }[/math] 的 前域(domain)或出发域(set of departure), [math]\displaystyle{ B }[/math] 称为二元关系 [math]\displaystyle{ R }[/math] 的 后域(codomain)或到达域(set of destination)。[1]
当 [math]\displaystyle{ A=B }[/math] 时称为齐次关系(homogeneous relation 或 endorelation),与之相对的 [math]\displaystyle{ A\neq B }[/math] 时称为非齐次关系(heterogeneous relation)。[2]
从 [math]\displaystyle{ A }[/math] 到 [math]\displaystyle{ A }[/math] 的二元关系也称为 [math]\displaystyle{ A }[/math] 上的二元关系。
表示
元组及有序对使用尖括号和圆括号的场景均不少见,本 wiki 统一使用圆括号。
关系有以下几种表示方法:
- 集合的描述法: [math]\displaystyle{ \left\{ (x, y) \mid x = y - 1 \right\} }[/math] ,非正式时也可以简化为谓词部分的关系式 [math]\displaystyle{ x=y-1 }[/math]
- 集合的列举法: [math]\displaystyle{ \left\{ (1,2),(2,3),(3,4) \right\} }[/math]
- 关系图
- 关系矩阵
关系图
关系图 | |
---|---|
术语名称 | 关系图 |
英语名称 | arrow diagram |
对于两个集合,可以通过分别画出前后域、分别列出所有元素并使用从前域到后域的箭头来表示关系。对于前后域相同的情况,可以通过列出域中所有元素,并通过由元素指向另一个元素(或自身)的箭头表示关系中的有序对。这样的图表称为关系图(arrow diagram)。 关系图是一张图(graph),其顶点选取与关系为齐次关系还是非齐次关系有关。
对集合 [math]\displaystyle{ A }[/math] 上的齐次关系 [math]\displaystyle{ R }[/math] ,记有向图 [math]\displaystyle{ (A, R) }[/math] , 以集合中的元素为顶点集、关系中的元素作为有向边集,称为关系 [math]\displaystyle{ R }[/math] 的图示,简称关系图,记作 [math]\displaystyle{ G_R }[/math] 。
对集合 [math]\displaystyle{ A }[/math] 、 [math]\displaystyle{ B }[/math] 上的非齐次关系 [math]\displaystyle{ R }[/math] ,记有向图 [math]\displaystyle{ (V, E) }[/math] , 以前域和后域全体元素的集合 [math]\displaystyle{ V = A \sqcup B = \left\{ a_A | a \in A \right\} \cup \left\{ b_B \mid b \in B \right\} }[/math] 为顶点集(此处加入下标表示前后域交集中的元素需要被标记为两个不同顶点)、 以关系中元素的集合 [math]\displaystyle{ E = \left\{ (a_A, b_B) \mid (a, b) \in R \right\} }[/math] 为边集, 这样的图是 [math]\displaystyle{ R }[/math] 的关系图。
前后域相同的关系图是一种有向图,前后域不同的关系图是一种有向二部图。有时也用这个类型来区分。
关系矩阵
关系矩阵 | |
---|---|
术语名称 | 关系矩阵 |
英语名称 | relation matrix |
别名 | logical matrix |
对集合 [math]\displaystyle{ A = \{ a_1, a_2, \dots , a_m \} }[/math] 和 [math]\displaystyle{ B = \{ b_1, b_2, \dots , b_n \} }[/math] 上的关系 [math]\displaystyle{ R }[/math] , 记矩阵 [math]\displaystyle{ M_R = \left( r_{ij} \right)_{m \times n} }[/math] ,其中 [math]\displaystyle{ r_{ij} = \begin{cases} 1, & (a_i, b_j) \in R \\ 0, & (a_i, b_j) \in R \end{cases} }[/math] ,称为 [math]\displaystyle{ R }[/math] 的关系矩阵(relation matrix)。
关系矩阵是一种布尔矩阵。有时也直接将关系矩阵叫做关系的布尔矩阵(logical matrix)。
有关系
对 [math]\displaystyle{ X }[/math] 到 [math]\displaystyle{ Y }[/math] 的关系 [math]\displaystyle{ R }[/math] 及 [math]\displaystyle{ x \in X, y\in Y }[/math] :
若 [math]\displaystyle{ (x,y)\in R }[/math] ,称 [math]\displaystyle{ x }[/math] 和 [math]\displaystyle{ y }[/math] 有关系 [math]\displaystyle{ R }[/math] ([math]\displaystyle{ x }[/math] and [math]\displaystyle{ y }[/math] are [math]\displaystyle{ R }[/math]-related / [math]\displaystyle{ x }[/math] and [math]\displaystyle{ y }[/math] are related by [math]\displaystyle{ R }[/math] / [math]\displaystyle{ x }[/math] is [math]\displaystyle{ R }[/math]-related to [math]\displaystyle{ y }[/math]),记作 [math]\displaystyle{ xRy }[/math] 。
相反,若 [math]\displaystyle{ (x,y) \notin R }[/math] ,称 [math]\displaystyle{ x }[/math] 和 [math]\displaystyle{ y }[/math] 没有关系 [math]\displaystyle{ R }[/math] ([math]\displaystyle{ x }[/math] and [math]\displaystyle{ y }[/math] are not [math]\displaystyle{ R }[/math]-related / [math]\displaystyle{ x }[/math] and [math]\displaystyle{ y }[/math] are not related by [math]\displaystyle{ R }[/math] / [math]\displaystyle{ x }[/math] is not [math]\displaystyle{ R }[/math]-related to [math]\displaystyle{ y }[/math]),记作 [math]\displaystyle{ x \not R y }[/math] 或 [math]\displaystyle{ x \lnot R y }[/math] 。
关系和运算
全部搜索结果
以下是本 wiki 中通过搜索页面结构化数据聚合的列表,仅供参考。
搜索到相关的特殊值:
对象类型 | |
---|---|
恒等关系 | 关系 |
空关系 | 关系 |
全关系 | 关系 |
搜索到相关的关系:
空列表
搜索到相关的运算:
页面 | 运算名称 | 运算对象 | 运算元数 | 运算结果 |
---|---|---|---|---|
并(关系)#并关系 | 并关系 | 关系 | 2 | 关系 |
补(关系)#补关系 | 补关系 | 关系 | 1 | 关系 |
差(关系)#差关系 | 差关系 | 关系 | 2 | 关系 |
传递闭包#传递闭包 | 传递闭包 | 关系 | 1 | 关系 |
等价闭包#等价闭包 | 等价闭包 | 关系 | 1 | 关系 |
对称闭包#对称闭包 | 对称闭包 | 关系 | 1 | 关系 |
反自反核#自反约简/反自反核 | 自反约简/反自反核 | 关系 | 1 | 关系 |
复合(关系)#复合 | 复合 | 关系 | 2 | 关系 |
交(关系)#交关系 | 交关系 | 关系 | 2 | 关系 |
幂(关系)#幂关系 | 幂关系 | 关系 自然数 | 2 | 关系 |
逆关系#逆关系 | 逆关系 | 关系 | 1 | 关系 |
商集#商集 | 商集 | 集合 关系 | 2 | 集族 |
限制(关系)#限制 | 限制 | 关系 | 2 | 关系 |
自反闭包#自反闭包 | 自反闭包 | 关系 | 1 | 关系 |
自反传递闭包#自反传递闭包 | 自反传递闭包 | 关系 | 1 | 关系 |