| components | R Documentation |
Partition a graph into maximal weakly or strongly connected
components. This query supports every graph class, including cyclic graphs
of class "UNKNOWN".
components(cg, mode = c("weak", "strong"))
cg |
A |
mode |
Character; |
Every strong component of a DAG is a singleton. Strong components
describe mutual directed reachability, whereas districts() describe
connectivity through bidirected edges.
A list of character vectors, one per component. Nodes within each
component follow the graph's node order, and components are ordered by their
first node in that order. Isolated nodes form singleton components. An empty
graph returns list().
Other queries:
ancestors(),
anteriors(),
children(),
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(),
subgraph(),
topological_sort()
cg <- caugi(A %-->% B, C %-->% B, D, class = "DAG")
components(cg) # list(c("A", "B", "C"), "D")
components(cg, mode = "strong") # Four singleton components
cyclic <- caugi(
A %-->% B, B %-->% C, C %-->% A, C %-->% D,
class = "UNKNOWN"
)
components(cyclic, mode = "strong") # list(c("A", "B", "C"), "D")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.