Learn R Programming

pcalg (version 2.0-3)

find.unsh.triple: Find all Unshielded Triples in an Undirected Graph

Description

Find all unshielded triples in an undirected graph, $q$, i.e., the ordered ($(x,y,z)$ with $x < z$) list of all the triples in the graph.

Usage

find.unsh.triple(g, check=TRUE)

Arguments

g
adjacency matrix ($p \times p$) of (the skeleton of) the graph. g must be symmetric, with 0/1 entries for presence of edges.
check
logical indicating that the symmetry of g should be checked.

Value

  • unshTriplMatrix with 3 rows containing in each column an unshielded triple
  • unshVectVector containing the unique number for each column in unshTripl (for internal use only)

Details

A triple of nodes x, y and z is unshielded, if (all of these are true): [object Object],[object Object],[object Object]

Examples

Run this code
data(gmG)
if (require(Rgraphviz)) {
  ## show graph
  plot(gmG$g, main = "True DAG")
}

## prepare skeleton use in example
g <- wgtMatrix(gmG$g) ## compute weight matrix
g <- 1*(g != 0) # wgts --> 0/1; still lower triangular
print.table(g, zero.print=".")
skel <- g + t(g) ## adjacency matrix of skeleton

## estimate unshielded triples -- there are  13 :
(uTr <- find.unsh.triple(skel))
stopifnot(ncol(uTr$unshTripl) == 13)

Run the code above in your browser using DataLab