navigate_network_dfs {hydroloom} | R Documentation |
Navigate all Paths Depth First
Description
given a starting node, return all reachable paths. Once visited, a node is marked as visited and will not take part in a future path.
Usage
navigate_network_dfs(x, starts, direction = "down", reset = FALSE)
Arguments
x |
data.frame containing hydroloom compatible network or list as returned by make_index_ids (for down) or make_fromids (for up). The list formats avoids recreating the index ids for every call to navigate network dfs in the case that it needs to be called many times. |
starts |
vector with ids from x to start at. |
direction |
character "up or "down" |
reset |
logical if TRUE, reset graph for each start such that later paths will have overlapping results. |
Value
list containing dfs result for each start.
Examples
x <- hy(sf::read_sf(system.file("extdata/new_hope.gpkg", package = "hydroloom")))
x <- add_toids(x, return_dendritic = FALSE)
navigate_network_dfs(x, 8893402)
navigate_network_dfs(x, 8897784, direction = "up")
[Package hydroloom version 1.0.2 Index]