dag <- cgraph(B %-->% A, A %-->% C)
nodes(dag)
#> [1] "A" "B" "C"
topological_sort(dag)
#> [1] "B" "A" "C"
exogenous_nodes(dag)
#> [1] "B"
pdag <- cgraph(A %-->% B, B %---% C, class = "PDAG")
exogenous_nodes(pdag)
#> [1] "A" "C"
exogenous_nodes(pdag, undirected_as_parents = TRUE)
#> [1] "A"

Graph-level node queries
Source: R/construction.R, R/jlbind-wrappers.R
Description
nodes() returns all node names in alphabetical order. topological_sort() returns the nodes of a DAG in topological order: for every directed edge u --> v, u appears before v. exogenous_nodes() returns the nodes with no parents.
Usage
nodes(cg)
topological_sort(cg)
exogenous_nodes(cg, undirected_as_parents = FALSE)Arguments
cg
|
A graph created with
|
undirected_as_parents
|
Only used for UG and PDAG-family graphs. If TRUE, a node incident to any undirected edge is not considered exogenous.
|
Value
Character vector of node names.