Construct a simple version of the network. A simple network is defined as a network without loop edges and multiple edges. A loop edge is an edge that starts and ends at the same node. Multiple edges are different edges between the same node pair.
Usage
simplify_network(
x,
remove_multiple = TRUE,
remove_loops = TRUE,
attribute_summary = "first",
store_original_ids = FALSE,
store_original_data = FALSE
)
Arguments
- x
An object of class
sfnetwork
.- remove_multiple
Should multiple edges be merged into one. Defaults to
TRUE
.- remove_loops
Should loop edges be removed. Defaults to
TRUE
.- attribute_summary
How should the attributes of merged multiple edges be summarized? There are several options, see
igraph-attribute-combination
for details.- store_original_ids
For each group of merged multiple edges, 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 group of merged multiple edges, 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 simple network as object of class sfnetwork
.
Note
When merging groups of multiple edges into a single edge, the geometry
of the first edge in each group is preserved. The order of the edges can be
influenced by calling arrange
before simplifying.