View source: R/findDescendants.R
Ancestors and descendants of a node in a directed graph | R Documentation |
Returns and plots, if asked, the descendants or ancestors of one or all node(s) (or variable(s))
findDescendants(G, node = NULL, graph = FALSE) findAncestors(G, node = NULL, graph = FALSE)
G |
The graph matrix as produced from |
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). |
The functions searches for the descendants of some node. This is an S3 class output.
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. If the argument "node" is NULL, only this matrix will be returned. |
Ganc |
A matrix of dimensions equal to the number of descendants of the node with 0s and 1s, if the argument "node" is not NULL. |
anc |
The descendants of the node if the argument "node" is not NULL. |
Anna Roumpelaki
R implementation and documentation: Anna Roumpelaki <anna.roumpelaki@gmail.com>
plotnetwork, nei, mb, pc.or
# 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 plotnetwork(G) findDescendants(G, 4, graph = FALSE) findAncestors(G, 4, graph = FALSE) findAncestors(G)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.