$M_{R^n}$; how to derive $n$ for transitive closure?

125 Views Asked by At

When finding the transitive closure of a relation $R$, I convert $R$ into a boolean matrix $M_R$, and find the union between $M_R$ and its powers up to $n$.

$$M_{R^*} = M_{R^1} \lor M_{R^2} \lor \cdots \lor M_{R^n}$$

But, what is $n$ in this case?

$$M_R = \begin{bmatrix} 1 & 0 & 1 \\ 0 & 1 & 0 \\ 1 & 1 & 0 \end{bmatrix}$$

To find the transitive closure of this matrix, I would perform $M_R \lor M_{R^2} \lor M_{R^3}$, which yields the matrix:

$$M_{R^*} = \begin{bmatrix} 1 & 1 & 1 \\ 0 & 1 & 0 \\ 1 & 1 & 1 \end{bmatrix}$$

But this is just an example I read. I'm not sure why $n$ in this case is 3, but for some other transitive closures it's 5, or 6, or 2, etc. Given a relation, how do I calculate $n$?

Update

Upon further reading, it looks like $n$ is the number of elements in the relation, but in some of the examples I have, some relations of size $5$ for example, only compute $M_{R^*}$ up to the $4th$ power. Is there some exclusivity principle depending on the relation? Here's an example:

$$R_1 = \{(a,c),(b,d),(c,a),(d,b),(e,d)\} \text{ on } \{a,b,c,d,e\}\\ R_2 = \{(b,c),(b,e),(c,e),(d,a),(e,b),(e,c)\} \text{ on } \{a,b,c,d,e\}$$

Why is $n = 4$ for $R_1$, but $n = 5$ for $R_2$ provided both relations are working with five elements?

1

There are 1 best solutions below

2
On BEST ANSWER

If you calculate the transitive closure there is a certain moment that you cannot add anything else (in the worst case this happens when every pair is related). The $n$ is simply the number of 'generations' you need to stabilize the exclusive or.