Ancestors {ggm} | R Documentation |
Compute the overall ancestors graph from a given DAG.
ancGraph(A) anGraph(A)
A |
a square Boolean matrix representing the edge matrix of the DAG |
The overall ancestor graph is a graph obtained from a DAG by computing the transitive closure. This graph has a non zero (i,j] entry iff node j is an ancestor of node i.
ancGraph
is based on a simple
formula (2 I - A)^{-1} explained by Wermuth and Cox (2003).
anGraph
instead uses repeated composition applied to the original
edge matrix. If A
is not a DAG sometimes ancGraph
fails, while
anGraph
is correct.
both functions return the same result, a square Boolean matrix of the
same order as A
giving the edge matrix of the overall ancestor graph.
Giovanni M. Marchetti
Wermuth, N. & Cox, D.R. (2003). Joint response graphs and separation induced by triangular systems. Submitted and available at http://psystat.sowi.uni-mainz.de.
dag <- DAG(y ~ x, x ~ z+u, u ~ v, a ~ v + b); dag anGraph(dag)