View source: R/extendr-wrappers.R
| subgraph | R Documentation |
Get the induced subgraph
subgraph(cg, nodes = NULL, index = NULL)
cg |
A |
nodes |
A character vector of node names. |
index |
A vector of node indexes. |
A new caugi that is a subgraph of the selected nodes.
Other queries:
ancestors(),
anteriors(),
children(),
components(),
descendants(),
districts(),
edge_types(),
edges(),
exogenous(),
is_acyclic(),
is_admg(),
is_ag(),
is_caugi(),
is_cpdag(),
is_dag(),
is_empty_caugi(),
is_mag(),
is_mpdag(),
is_pdag(),
is_simple(),
is_ug(),
m_separated(),
markov_blanket(),
neighbors(),
nodes(),
parents(),
posteriors(),
same_nodes(),
spouses(),
topological_sort()
cg <- caugi(
A %-->% B,
B %-->% C,
class = "DAG"
)
sub_cg <- subgraph(cg, c("B", "C"))
cg2 <- caugi(B %-->% C, class = "DAG")
all(nodes(sub_cg) == nodes(cg2)) # TRUE
all(edges(sub_cg) == edges(cg2)) # TRUE
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.