[R] Add transitivity to a matrix?

Richard O'Keefe r@oknz @end|ng |rom gm@||@com
Tue Jun 18 02:12:44 CEST 2019


You have: a square logical matrix M representing a binary relation.
You want: a similar matrix representing the least (fewest true cases)
transitive relation extending what M represents.
It sound as though you are looking for the TRANSITIVE CLOSURE.
You will find that in the 'relations' package.


On Tue, 18 Jun 2019 at 05:39, Duncan Murdoch <murdoch.duncan using gmail.com>
wrote:

> Suppose I have a square logical matrix M which I'm thinking of as a
> relation between the row/column numbers.
>
> I can make it into a symmetric relation (i.e. M[i,j] being TRUE implies
> M[j,i] is TRUE) by the calculation
>
> M <- M | t(M)
>
> Is there a simple way to ensure transitivity, i.e. M[i,j] & M[j,k] both
> being TRUE implies M[i,k] is TRUE?
>
> The operation should only change FALSE or NA values to TRUE values; TRUE
> values should never be changed.
>
> Duncan Murdoch
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list