ArticleslgStudy

computer science

Transitive closure

Transitive closure is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Transitive closure rather than just read about it. In short: In mathematics, the transitive closure R+ of a homogeneous binary relation R on a set X is the smallest relation on X that contains R and is transitive. For finite sets, "smallest" can be taken in its usual sense, of having the fewest related pairs; for infinite sets R+ is the unique minimal transitive superset of R.

Transitive closure — main illustration
Transitive closure — illustration

Key takeaways

  • Transitive closure belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Transitive closure to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Transitive closure from memory before moving on to harder problems.

Reference excerpt

In mathematics, the transitive closure R+ of a homogeneous binary relation R on a set X is the smallest relation on X that contains R and is transitive. For finite sets, "smallest" can be taken in its usual sense, of having the fewest related pairs; for infinite sets R+ is the unique minimal transitive superset of R. For example, if X is a set of airports and x R y means "there is a direct flight from airport x to airport y" (for x and y in X), then the transitive closure of R on X is the relation R+ such that x R+ y means "it is possible to fly from x to y in one or more flights". More formally, the transitive closure of a binary relation R on a set X is the smallest (w.r.t. ⊆) transitive relation R+ on X such that R ⊆ R+; see Lidl & Pilz (1998, p. 337). We have R+ = R if, and only if, R itself is transitive. Conversely, transitive reduction reduces a minimal relation S from a given relation R such that they have the same closure, that is, S+ = R+; however, many different S with this property may exist. Both transitive closure and transitive reduction are also used in the closely related area of graph theory.

Transitive relations and examples A relation R on a set X is transitive if, for all x, y, z in X, whenever x R y and y R z then x 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 before y" on the set of all people. Symbolically, this can be denoted as: if x < y and y < z then x < z. One example of a non-transitive relation is "city x can be reached via a direct flight from city y" 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 city x and ends at city y". 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 the day of the week after y". The transitive closure of this relation is "some day x comes after a day y on the calendar", which is trivially true for all days of the week x and y (and thus equivalent to the Cartesian square, which is "x and y are both days of the week").

Existence and description For any relation R, the transitive closure of R always exists. To see this, note that the intersection of any family of transitive relations is again transitive. Furthermore, there exists at least one transitive relation containing R, namely the trivial one: X × X. The transitive closure of R is then given by the intersection of all transitive relations containing R. For finite sets, we can construct the transitive closure step by step, starting from R and adding transitive edges. This gives the intuition for a general construction. For any set X, we can prove that transitive closure is given by the following expression

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

where R i {\displaystyle R^{i}} is the i-th power of R, defined inductively by

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

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

R i + 1 = R ∘ R i {\displaystyle R^{i+1}=R\circ R^{i}}

where ∘ {\displaystyle \circ } denotes composition of relations. To show that the above definition of R+ is the least transitive relation containing R, we show that it contains R, that it is transitive, and that it is the smallest set with both of those characteristics.

R ⊆ R + {\displaystyle R\subseteq R^{+}} : R + {\displaystyle R^{+}} contains all of the R i {\displaystyle R^{i}} , so in particular R + {\displaystyle R^{+}} contains R {\displaystyle R} .

… excerpt ends here. Continue reading the full article.

Illustrations

Transitive closure: A cluster graph, the transitive closure of an undirected graph
A cluster graph, the transitive closure of an undirected graph

Worked examples

Example 1 — a first encounter with Transitive closure

Start with the simplest possible case. Write down what Transitive closure claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Transitive closure before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Transitive closure ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Transitive closure

In research
Transitive closure appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Transitive closure in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Transitive closure is common in secondary-school and first-year university syllabi. It links to neighbouring topics Binary relations, Closure operators, Graph algorithms, so understanding it makes those chapters shorter.
In everyday life
Look for Transitive closure outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Transitive closure in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Transitive closure means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Transitive closure out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Transitive closure in simple terms?

In mathematics, the transitive closure R+ of a homogeneous binary relation R on a set X is the smallest relation on X that contains R and is transitive. For finite sets, "smallest" can be taken in its usual sense, of having the fewest related pairs; for infinite sets R+ is the unique minimal transi…

Why does Transitive closure matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Transitive closure?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Transitive closure.

Tags

  • Binary relations
  • Closure operators
  • Graph algorithms

Keep exploring