Root or leaves of the DAG

dag_root(dag, in_labels = TRUE)

dag_leaves(dag, in_labels = TRUE)

dag_is_leaf(dag, terms)

Arguments

dag

An ontology_DAG object.

in_labels

Whether the terms are represented in their names or as integer indices?

terms

A vector of term names.

Value

A character or an integer vector.

Examples

parents  = c("a", "a", "b", "b", "c", "d")
children = c("b", "c", "c", "d", "e", "f")
dag = create_ontology_DAG(parents, children)
dag_root(dag)
#> [1] "a"
dag_leaves(dag)
#> [1] "e" "f"