
Get the inter-domain edge list from a decomposition
Source:R/decompose_network.R
get_domain_graph.RdReturns the inter-domain edge list as a hydroloom edge list (hy_topo
or hy_flownetwork). Two kinds of relationships appear in the result,
selected by relations:
"flow"– pulled fromnexus_registry. Each row whoseto_domain_idis non-NA contributes one row to the result, recording where one domain hands off to the next at a hydro nexus. The result row carries that nexus's id innexus_idandrelation_type = "flow"."contained"– pulled from each domain'scontaining_domain_idslot. Each non-NA value contributes one row, from the contained domain to its container. Containment is declared post-decomposition viaset_containment()and does not pass through a hydro nexus, so the result row carriesnexus_id = NA_character_andrelation_type = "contained".
The default returns both kinds; pass relations = "flow" for the
inter-domain flow graph only, or relations = "contained" for
containment relationships only.
The returned object is passed through classify_hy() so it carries
the most-specific hydroloom class (hy_topo when the inter-domain
graph is dendritic, hy_flownetwork when it is not). This lets
downstream hydroloom functions like check_hy_graph() and
sort_network() dispatch on it without extra conversion.
Usage
get_domain_graph(decomposition, relations = c("flow", "contained"))Value
hydroloom edge list (hy_topo or hy_flownetwork) with
columns id, toid, nexus_id, relation_type.
See also
domain_decomposition for the wrapper object,
decompose_network(), set_containment().
Examples
g <- sf::read_sf(system.file("extdata/walker.gpkg", package = "hydroloom"))
h <- hy(g) |>
add_toids() |>
add_levelpaths(name_attribute = "GNIS_ID",
weight_attribute = "arbolate_sum")
d <- decompose_network(h)
get_domain_graph(d, relations = "flow")
#> # hydroloom dendritic edge list (self-referencing): 0 features
#> [1] id toid nexus_id relation_type
#> <0 rows> (or 0-length row.names)