Construct a smoothed version of the network by iteratively removing pseudo
nodes, while preserving the connectivity of the network. In the case of
directed networks, pseudo nodes are those nodes that have only one incoming
and one outgoing edge. In undirected networks, pseudo nodes are those nodes
that have two incident edges. Equality of attribute values among the two
edges can be defined as an additional requirement by setting the
require_equal
parameter. Connectivity of the network is preserved by
concatenating the incident edges of each removed pseudo node.
Usage
smooth_pseudo_nodes(
x,
protect = NULL,
require_equal = NULL,
attribute_summary = "ignore",
store_original_ids = FALSE,
store_original_data = FALSE
)
Arguments
- x
An object of class
sfnetwork
.- protect
An integer vector of edge indices specifying which nodes should be protected from being removed. Defaults to
NULL
, meaning that none of the nodes is protected.- require_equal
A character vector of edge column names specifying which attributes of the incident edges of a pseudo node should be equal in order for the pseudo node to be removed? Defaults to
NULL
, meaning that attribute equality is not considered for pseudo node removal.- attribute_summary
How should the attributes of concatenated edges be summarized? There are several options, see
igraph-attribute-combination
for details.- store_original_ids
For each concatenated edge, should the indices of the original edges be stored as an attribute of the new edge, in a column named
.tidygraph_edge_index
? This is in line with the design principles oftidygraph
. Defaults toFALSE
.- store_original_data
For each concatenated edge, should the data of the original edges be stored as an attribute of the new edge, in a column named
.orig_data
? This is in line with the design principles oftidygraph
. Defaults toFALSE
.
Value
The smoothed network as object of class sfnetwork
.