Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Transitive closure

From Wikipedia, the free encyclopedia
Smallest transitive relation containing a given binary relation
Transitive binary relations
SymmetricAntisymmetricConnectedWell-foundedHas joinsHas meetsReflexiveIrreflexiveAsymmetric
Total,
Semiconnex
Anti-
reflexive
Equivalence relationGreen tickYGreen tickY
Preorder(Quasiorder)Green tickY
Partial orderGreen tickYGreen tickY
Total preorderGreen tickYGreen tickY
Total orderGreen tickYGreen tickYGreen tickY
PrewellorderingGreen tickYGreen tickYGreen tickY
Well-quasi-orderingGreen tickYGreen tickY
Well-orderingGreen tickYGreen tickYGreen tickYGreen tickY
LatticeGreen tickYGreen tickYGreen tickYGreen tickY
Join-semilatticeGreen tickYGreen tickYGreen tickY
Meet-semilatticeGreen tickYGreen tickYGreen tickY
Strict partial orderGreen tickYGreen tickYGreen tickY
Strict weak orderGreen tickYGreen tickYGreen tickY
Strict total orderGreen tickYGreen tickYGreen tickYGreen tickY
SymmetricAntisymmetricConnectedWell-foundedHas joinsHas meetsReflexiveIrreflexiveAsymmetric
Definitions,
for alla,b{\displaystyle a,b} andS:{\displaystyle S\neq \varnothing :}
aRbbRa{\displaystyle {\begin{aligned}&aRb\\\Rightarrow {}&bRa\end{aligned}}}aRb and bRaa=b{\displaystyle {\begin{aligned}aRb{\text{ and }}&bRa\\\Rightarrow a={}&b\end{aligned}}}abaRb or bRa{\displaystyle {\begin{aligned}a\neq {}&b\Rightarrow \\aRb{\text{ or }}&bRa\end{aligned}}}minSexists{\displaystyle {\begin{aligned}\min S\\{\text{exists}}\end{aligned}}}abexists{\displaystyle {\begin{aligned}a\vee b\\{\text{exists}}\end{aligned}}}abexists{\displaystyle {\begin{aligned}a\wedge b\\{\text{exists}}\end{aligned}}}aRa{\displaystyle aRa}not aRa{\displaystyle {\text{not }}aRa}aRbnot bRa{\displaystyle {\begin{aligned}aRb\Rightarrow \\{\text{not }}bRa\end{aligned}}}
Green tickY indicates that the column's property is always true for the row's term (at the very left), while indicates that the property is not guaranteed
in general (it might, or might not, hold). For example, that every equivalence relation is symmetric, but not necessarily antisymmetric,
is indicated byGreen tickY in the "Symmetric" column and in the "Antisymmetric" column, respectively.

All definitions tacitly require thehomogeneous relationR{\displaystyle R} betransitive: for alla,b,c,{\displaystyle a,b,c,} ifaRb{\displaystyle aRb} andbRc{\displaystyle bRc} thenaRc.{\displaystyle aRc.}
A term's definition may require additional properties that are not listed in this table.

This article is about the transitive closure of a binary relation. For the transitive closure of a set, seeTransitive set § Transitive closure.

Inmathematics, thetransitive closureR+ of ahomogeneous binary relationR on asetX is the smallestrelation onX that containsR and istransitive. For finite sets, "smallest" can be taken in its usual sense, of having the fewest related pairs; for infinite setsR+ is the uniqueminimal transitivesuperset ofR.

For example, ifX is a set of airports andx R y means "there is a direct flight from airportx to airporty" (forx andy inX), then the transitive closure ofR onX is the relationR+ such thatxR+y means "it is possible to fly fromx toy in one or more flights".

More formally, the transitive closure of a binary relationR on a setX is the smallest (w.r.t. ⊆) transitive relationR+ onX such thatRR+; seeLidl & Pilz (1998, p. 337). We haveR+ =R if, and only if,R itself is transitive.

Conversely,transitive reduction reduces a minimal relationS from a given relationR such that they have the same closure, that is,S+ =R+; however, many differentS with this property may exist.

Both transitive closure and transitive reduction are also used in the closely related area ofgraph theory.

Transitive relations and examples

[edit]

A relationR on a setX is transitive if, for allx,y,z inX, wheneverx R y andy R z thenx R z. Examples of transitive relations include the equality relation on any set, the "less than or equal" relation on any linearly ordered set, and the relation "x was born beforey" on the set of all people. Symbolically, this can be denoted as: ifx <y andy <z thenx <z.

One example of a non-transitive relation is "cityx can be reached via a direct flight from cityy" on the set of all cities. Simply because there is a direct flight from one city to a second city, and a direct flight from the second city to the third, does not imply there is a direct flight from the first city to the third. The transitive closure of this relation is a different relation, namely "there is a sequence of direct flights that begins at cityx and ends at cityy". Every relation can be extended in a similar way to a transitive relation.

An example of a non-transitive relation with a less meaningful transitive closure is "x is theday of the week aftery". The transitive closure of this relation is "some dayx comes after a dayy on the calendar", which is trivially true for all days of the weekx andy (and thus equivalent to theCartesian square, which is "x andy are both days of the week").

Existence and description

[edit]

For any relationR, the transitive closure ofR always exists. To see this, note that theintersection of anyfamily of transitive relations is again transitive. Furthermore,there exists at least one transitive relation containingR, namely the trivial one:X ×X. The transitive closure ofR is then given by the intersection of all transitive relations containingR.

For finite sets, we can construct the transitive closure step by step, starting fromR and adding transitive edges.This gives the intuition for a general construction. For any setX, wecan prove that transitive closure is given by the following expression

R+=i=1Ri.{\displaystyle R^{+}=\bigcup _{i=1}^{\infty }R^{i}.}

whereRi{\displaystyle R^{i}} is thei-th power ofR, defined inductively by

R1=R{\displaystyle R^{1}=R}

and, fori>0{\displaystyle i>0},

Ri+1=RRi{\displaystyle R^{i+1}=R\circ R^{i}}

where{\displaystyle \circ } denotescomposition of relations.

To show that the above definition ofR+ is the least transitive relation containingR, we show that it containsR, that it is transitive, and that it is the smallest set with both of those characteristics.

Properties

[edit]

Theintersection of two transitive relations is transitive.

Theunion of two transitive relations need not be transitive. To preserve transitivity, one must take the transitive closure. This occurs, for example, when taking the union of twoequivalence relations or twopreorders. To obtain a new equivalence relation or preorder one must take the transitive closure (reflexivity and symmetry—in the case of equivalence relations—are automatic).

In graph theory

[edit]
Transitive closure constructs the output graph from the input graph.
Transitive closure constructs the output graph from the input graph.

Incomputer science, the concept of transitive closure can be thought of as constructing a data structure that makes it possible to answerreachability questions. That is, can one get from nodea to noded in one or more hops? A binary relation tells you only that node a is connected to nodeb, and that nodeb is connected to nodec, etc. After the transitive closure is constructed, as depicted in the following figure, in anO(1)-time operation one may determine that noded is reachable from nodea. The data structure is typically stored as a Boolean matrix, so if matrix[1][4] = true, then it is the case that node 1 can reach node 4 through one or more hops.

The transitive closure of the adjacency relation of adirected acyclic graph (DAG) is the reachability relation of the DAG and astrict partial order.

Acluster graph, the transitive closure of an undirected graph

The transitive closure of anundirected graph produces acluster graph, adisjoint union ofcliques. Constructing the transitive closure is an equivalent formulation of the problem of finding thecomponents of the graph.[1]

In logic and computational complexity

[edit]

The transitive closure of a binary relationcannot, in general, be expressed infirst-order logic (FO).This means that one cannot write a formula using predicate symbolsR andT that will be satisfied inany model if and only ifT is the transitive closure ofR.Infinite model theory, first-order logic (FO) extended with a transitive closure operator is usually calledtransitive closure logic, and abbreviated FO(TC) or just TC. TC is a sub-type offixpoint logics. The fact that FO(TC) is strictly more expressive than FO was discovered byRonald Fagin in 1974; the result was then rediscovered byAlfred Aho andJeffrey Ullman in 1979, who proposed to use fixpoint logic as adatabase query language.[2] With more recent concepts of finite model theory, proof that FO(TC) is strictly more expressive than FO follows immediately from the fact that FO(TC) is notGaifman-local.[3]

Incomputational complexity theory, thecomplexity classNL corresponds precisely to the set of logical sentences expressible in TC. This is because the transitive closure property has a close relationship with theNL-complete problemSTCON for findingdirected paths in a graph. Similarly, the classL is first-order logic with the commutative, transitive closure. When transitive closure is added tosecond-order logic instead, we obtainPSPACE.

In database query languages

[edit]
Further information:Hierarchical and recursive queries in SQL

Since the 1980sOracle Database has implemented a proprietarySQL extensionCONNECT BY... START WITH that allows the computation of a transitive closure as part of a declarative query. TheSQL 3 (1999) standard added a more generalWITH RECURSIVE construct also allowing transitive closures to be computed inside the query processor; as of 2011 the latter is implemented inIBM Db2,Microsoft SQL Server,Oracle,PostgreSQL, andMySQL (v8.0+).SQLite released support for this in 2014.

Datalog also implements transitive closure computations.[4]

MariaDB implements Recursive Common Table Expressions, which can be used to compute transitive closures. This feature was introduced in release 10.2.2 of April 2016.[5]

Algorithms

[edit]

Efficient algorithms for computing the transitive closure of the adjacency relation of a graph can be found inNuutila (1995). Reducing the problem to multiplications of adjacency matrices achieves the time complexity offast matrix multiplication algorithms,[6]O(n2.3728596){\displaystyle O(n^{2.3728596})}. However, this approach is not practical since both the constant factors and the memory consumption for sparse graphs are high (Nuutila 1995, pp. 22–23, sect.2.3.3). The problem can also be solved by theFloyd–Warshall algorithm inO(n3){\displaystyle O(n^{3})}, or by repeatedbreadth-first search ordepth-first search starting from each node of the graph.

For directed graphs,Purdom's algorithm solves the problem by first computing its condensation DAG and its transitive closure, then lifting it to the original graph. Its runtime isO(m+μn){\displaystyle O(m+\mu n)}, whereμ{\displaystyle \mu } is the number of edges between itsstrongly connected components.[7][8][9][10]

More recent research has explored efficient ways of computing transitive closure on distributed systems based on theMapReduce paradigm.[11]

See also

[edit]

References

[edit]
  1. ^McColl, W. F.; Noshita, K. (1986), "On the number of edges in the transitive closure of a graph",Discrete Applied Mathematics,15 (1):67–73,doi:10.1016/0166-218X(86)90020-X,MR 0856101
  2. ^(Libkin 2004:vii)
  3. ^(Libkin 2004:49)
  4. ^(Silberschatz et al. 2010:C.3.6)
  5. ^"Recursive Common Table Expressions Overview". mariadb.com.
  6. ^Munro 1971,Fischer & Meyer 1971
  7. ^Purdom Jr., Paul (Mar 1970)."A transitive closure algorithm".BIT Numerical Mathematics.10 (1):76–94.doi:10.1007/BF01940892.
  8. ^Paul W. Purdom Jr. (Jul 1968).A transitive closure algorithm (Computer Sciences Technical Report). Vol. 33.University of Wisconsin-Madison.
  9. ^""Purdom's algorithm" on AlgoWiki".
  10. ^""Transitive closure of a directed graph" on AlgoWiki".
  11. ^(Afrati et al. 2011)

External links

[edit]
Key concepts
Results
Properties & Types (list)
Constructions
Topology & Orders
Related
Retrieved from "https://en.wikipedia.org/w/index.php?title=Transitive_closure&oldid=1333127852"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2026 Movatter.jp