least_common_parents: Find the least common parents in a graph

View source: R/least_common_parents.R View source: R/extendr-wrappers.R View source: R/extendr-wrappers.R

least_common_parentsR Documentation

Find the least common parents in a graph

Description

It finds the nodes that have no parents in the given set.

Usage

least_common_parents(graph, selected)

Arguments

graph

A graph object

selected

A character vector of node ids

Value

A character vector of node ids

See Also

Other analyze graphs: find_all_paths(), find_path(), find_path_one_to_many(), get_all_leaves(), get_all_roots(), get_leaves_under(), get_roots_over()

Examples

graph_edges <- data.frame(
  parent = c("A", "B", "C", "C", "F"),
  child = c("B", "C", "D", "E", "D")
)

graph <- graph_builder() |>
  populate_edges(graph_edges, parent, child) |>
  build_directed()
graph

graph |> least_common_parents(c("D", "E"))

orbweaver documentation built on June 8, 2025, 11:40 a.m.