Learn R Programming

caugi (version 1.0.0)

children: Get children of nodes in a caugi

Description

Get children of nodes in a graph (nodes with directed edges pointing OUT from the target nodes). This is equivalent to neighbors(cg, nodes, mode = "out").

Usage

children(cg, nodes = NULL, index = NULL)

Value

Either a character vector of node names (if a single node is requested) or a list of character vectors (if multiple nodes are requested).

Arguments

cg

A caugi object.

nodes

A vector of node names, a vector of unquoted node names, or an expression combining these with + and c().

index

A vector of node indexes.

See Also

Other queries: ancestors(), anteriors(), descendants(), districts(), edge_types(), edges(), exogenous(), is_acyclic(), is_admg(), is_ag(), is_caugi(), is_cpdag(), is_dag(), is_empty_caugi(), is_mag(), is_pdag(), is_ug(), m_separated(), markov_blanket(), neighbors(), nodes(), parents(), same_nodes(), spouses(), subgraph(), topological_sort()

Examples

Run this code
cg <- caugi(
  A %-->% B,
  B %-->% C,
  class = "DAG"
)
children(cg, "A") # "B"
children(cg, index = 2) # "C"
children(cg, "B") # "C"
children(cg, c("B", "C"))
#> $B
#> [1] "C"
#>
#> $C
#> NULL

Run the code above in your browser using DataLab