Learn R Programming

MXM (version 0.9.3)

Descendants of a node in a directed graph: Returns and plots, if asked, the descendants of a node (or variable)

Description

Returns and plots, if asked, the descendants of a node (or variable).

Usage

findDescendants(G, node, graph = FALSE)

Arguments

G
The graph matrix as produced from pc.or or any other algorithm which produces directed graphs.
node
A numerical value indicating the node (or variable) whose descendants are to be returned.
graph
A boolean variable. If TRUE the relevant graph will appear (if there are descendants).

Value

isAnc
A matrix of the same dimensions as the original graph matrix with 0s and 1s. isAnc[i, j] = 1 indicates that the i-th node is an ancestor of the j-th node.
Ganc
A matrix of dimensions equal to the number of descendants of the node with 0s and 1s.
anc
The descendants of the node.

Details

The functions searches for the descendants of some node. This is an S3 class output.

See Also

plota, nei, pc.or

Examples

Run this code
# simulate a dataset with continuous data
# simulate a dataset with continuous data
y = rdag(1000, 10, 0.3)
tru = y$G 
x = y$x
mod = pc.con(x)
G = pc.or(mod)$G
plota(G)
findDescendants(G, 4, graph = FALSE)

Run the code above in your browser using DataLab