[R] Intransitive DAG

David Winsemius dwinsemius at comcast.net
Mon Jul 11 23:56:44 CEST 2011


On Jul 11, 2011, at 3:28 PM, Thomas S. Dye wrote:

> Aloha all,
>
> I have an adjacency matrix for an acyclic digraph that contains
> transitive relations, e.g. (u,v), (v,w), (u,w).  I want a DAG with  
> only
> intransitive relations.  Can someone point me to an R function that  
> will
> take my adjacency matrix and give me back one with only intransitive
> relations?  In the example, I'd like to get rid of (u,w) and keep  
> (u,v)
> and (v,w).

I'm needing to guess at what sort of code you are using but assuming  
this is a square matrix:

require(ggm)
dag <- DAG(y ~ x, x ~ z, u~z)
 > which(dag != t(dag), arr.ind=TRUE)
   row col
x   2   1
y   1   2
z   3   2
x   2   3
u   4   3
z   3   4

> All the best,
> Tom
> -- 
> Thomas S. Dye
> http://www.tsdye.com
>
> ______________________________________________
> R-help at r-project.org mailing list
> 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.

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list