Finds a path between two nodes in a graph.
Different types of graphs use different algorithms to
find the paths. a DirectedGraph uses breadth-first search
while an DirectedAcyclicGraph uses topological sort.
The path is represented as a character vector with the node ids of the nodes that make up the path.
See also
Other analyze graphs:
find_all_paths(),
find_path_one_to_many(),
get_all_leaves(),
get_all_roots(),
get_leaves_under(),
get_roots_over(),
least_common_parents()
Examples
graph <- graph_builder() |>
add_path(c("A", "B", "C")) |>
build_directed()
find_path(graph, "A", "C")
#> # of nodes: 3
#> | Nodes |
#> | A |
#> | B |
#> | C |
#>