Skip to contents

Detect whether a braid exists in a NHDPlus flowlines Network Check if if a NHDPlus network dataset contains any braids. If multiple discontinuous networks are within the 'network' data, a 'terminal_id' can be be provided to uniquely check each network for braids. If no terminal_id is given, the function will try to infer the distinct networks and then check for braids in each component (using find_connected_components()).

Usage

is_braided(network, terminal_id = NULL, recycle = FALSE, verbose = FALSE)

Arguments

network

data.frame with comid, tonode, fromnode, divergence and (optionally) terminalpa attributes.

terminal_id

character, column name containing a unique identifier, delineating separate networks in the 'network' dataset. Default is NULL which will use 'find_connected_components()' and determine the connected components in the graph to try and create a 'component_id' column in 'network'

recycle

logical, whether the return logical vector should be recycled to the length of the number of unique networks (disconnected networks/outlets/terminalpa). If FALSE (default), the function returns TRUE if ANY of the networks contain a braid. Otherwise, if TRUE, the function attempts to distinguish the different/separate network components and returns a logical vector the length of the number of connected components in the network.If a 'terminal_id' is given, the return logical vector will use the 'terminal_id' column to name the vector, if 'terminal_id' is NULL, then an arbitrary COMID is used to uniquely identify each distinct port of the network and these arbitrary COMIDs are used to name the logical vector elements.

verbose

logical print status updates, if TRUE, messages will print. Default is FALSE.

Value

logical, If TRUE, atleast one braid was detected in network, FALSE if no braids were found. If multiple components are found OR a terminal_id column is given, each unique network is checked for braiding (recycles to length of unique "terminal_id")