A relation R on a set A is called irreflexive if $(a,a) \notin R$ for every element $a \in A$, in effect there are no loops.
For example:
Irreflexive: <, >, = on N or on Z
Elements do not refer to themselves.
Irreflexive: R3={(1,2),(1,3),(2,1),(3,2)} on {1,2,3}
digraph G { 1->2 1->3 2->1 3->2}
title: Not all "not reflexive" relations are irreflexive!**Not irreflexive**: $R_2 = \{ (1,1), (1,2), (3,1) \}$ on $\{ 1,2,3 \}$Some elements refer to themselves.```graphvizdigraph G { 1->1 1->2 3->1}
A relation R on a set A is called symmetric, if for all elements $a, b \in A$, $(b,a) \in R$ whenever $(a, b) \in R$. In effect, all relations must be mirrored.
For example:
Symmetric: R1={(1,1),(1,2),(2,1),(2,3),(3,2),(3,3)} on {1,2,3}
All pairs of elements have the same properties in both directions.
digraph G { 1->1 1->2 2->1 2->3 3->2 3->3}
Symmetric: R2={(1,1),(2,2),(3,3)} on {1,2,3}
All pairs of elements have the same properties in both directions.
digraph G { 1->1 2->2 3->3}
Symmetric: {(x,y)∈N×N∣x−y is divisible by 3} on N
Not symmetric: R3={(1,1),(1,2),(2,1),(3,1),(3,3)} on {1,2,3}
Not all pairs of elements have the same properties in both directions.
A relation R on a set A is called antisymmetric, if $(a, b)$ and $(b, a)$ cannot both be in $R$ unless $a = b$.
(it also does not mean (a,a) should be in R)
This is also not opposite to symmetric, instead it means that you can go one way but you cannot come back unless if you’re going from an element to itself.
For example:
Antisymmetric: <, >, leq, geq on N, Z, Q or R.
Antisymmetric: R1={(1,1),(1,3),(2,3),(3,3)} on {1,2,3}
You can go one way but not the other.
digraph G { 1->1 1->3 2->3 3->3}
Antisymmetric (also symmetric): R2={(1,1),(2,2),(3,3)} on {1,2,3}
You can go one way but not the other.
digraph G { 1->1 2->2 3->3}
Not antisymmetric: R3={(1,1),(1,2),(2,1)} on {1,2}
There are bi-directional paths here.
A relation R on a set A is called transitive, if the following hold, for all elements a,b,c∈A: $$ \text{If both } (a, b) \in R \text{ and } (b, c) \in R \text{ then } (a, c) \in R $$
In the directed graph representing R, R is transitive, if every two-step journey along arrows can be done in one step. For example:
The following graphs are not transitive:
digraph A { x->y y->z z->w x->z}digraph B { x->y y->z z->w x->z x->w}
The following graph is transitive:
digraph B { x->y y->z z->w x->z x->w y->w}
Transitive: <, >, ≤, ≥ on N, Z, Q, or R
For example, if a<b then b<c and so on…
Transitive: R1={(1,1),(1,2),(1,3),(2,2),(2,3),(3,3)} on {1,2,3,4}
digraph B { 1->1 1->2 1->3 2->2 2->3 3->3}
Transitive: R2={(3,4)} on {3,4}
We cannot show it’s not transitive, since we only have one one-step journey.
Given that R is a relation on a set A. The transitive closure of R is the smallest transitive relation on $A$ containing $R$. We denote the transitive closure of $R$ by $\boxed {R^*}$.
If R is already transitive, then R∗=R.
For example, given the following definition of R, we find R∗:
digraph A { label="R" x->y y->z z->w x->z}digraph B { label="R*" x->y y->z z->w x->z x->w y->w}
Given R, we can define the transitive closure, R∗, recursively:
?
Basis step: R⊆R∗
The pairs in R are all in R∗.
Recursive step: If (a,b)∈R∗ and (b,c)∈R∗ then (a,c)∈R∗.
We add the missing pairs step by step.
Warshall’s algorithm
Warshall's algorithm
Algorithm
An algorithm is a finite sequence of precise step-by-step instructions.
Warshall’s algorithm computes the matrix of the transitive closure R∗ of R.
?
Given a relation R on a set A with n elements, we begin with its n×n matrix. M0
There are n rounds.
For each, we mutate the matrix.
M0⇝round 1M1⇝round 2M2⇝round 3...⇝round nMnMn is the matrix of the transitive closure R∗ of R.
1st rule: never change 1 to 0
2nd rule: for the k round, we select the kth row and the kth column, we look at all of the 0 values not in this row or column. From the position of the 0 value we are looking at, we check to see if the corresponding cells in the kth row and column are 1, if they are, we change 0 to 1 otherwise we don’t do anything.
ikth rowjkth column0↓1→1⇝round kikjk111