These functions reformat the loops and the parallel ties of a network, keeping its nodes.

  • to_anti() reformats network data into its complement, where only ties not present in the original network are included in the new network.

  • to_unlooped() removes the loops of a network, the ties from a node to itself. Parallel ties are kept, since a second tie between two nodes is not a loop; tie_is_parallel() marks them.

  • to_looped() adds a loop to every node, as a diagonal of ones, so that each node is one of its own neighbours. A node that has a loop already gets no second one. A multiplex network gets the loops in each layer, and a network with moments gets them at each moment, for the nodes that are active then.

  • to_simplified() removes the loops of a network and combines its parallel ties by the rule, so that is_simplified() marks it TRUE. Every layer stays: use to_layer() to keep one, or to_aggregated(over = "layer") to combine them.

If the format condition is not met, for example to_unlooped() is used on a network that has no loops, the network data is returned unaltered. No warning is given so that these functions can be used to ensure conformance.

Unlike the as_*() group of functions, these functions always return the same class as they are given, only transforming these objects' properties.

to_anti(.data)

to_unlooped(.data)

to_looped(.data)

to_simplified(.data, rule = c("max", "min", "mean", "sum", "product"))

Arguments

.data

An object of a {manynet}-consistent class:

  • adjacency or incidence matrix from {base} R

  • edgelist data.frame from {base} R or tbl/tbl_df from {tibble}

  • stocnet stocnet, from the {manynet} package

  • igraph igraph, from the {igraph} package

  • network network, from the {network} package

  • tidygraph tbl_graph, from the {tidygraph} package

rule

How the values of parallel ties are combined into one tie: "max" (the default), "min", "mean", "sum", or "product".

Value

An object of the same class as the function was given, modified as explained in the function description, details, or section. Functions that split a network return a list of such objects.

Details

Not all functions have methods available for all object classes. Below are the currently implemented S3 methods:

            data.frame default igraph matrix stocnet tbl_graph
to_anti              *       *      *      *                 *
to_looped                    *             *       *
to_unlooped          *       *      *      *       *         *

Examples

to_anti(ison_southern_women)
#> # A labelled, two-mode network of 18 FALSEs and 14 TRUEs and 163 ties
#> 
#> ── Nodes 
#> # A tibble: 32 × 2
#>   label     mode 
#>   <chr>     <chr>
#> 1 Evelyn    FALSE
#> 2 Laura     FALSE
#> 3 Theresa   FALSE
#> 4 Brenda    FALSE
#> 5 Charlotte FALSE
#> 6 Frances   FALSE
#> # ℹ 26 more rows
#> 
#> ── Ties 
#> # A tibble: 163 × 2
#>    from    to
#>   <int> <int>
#> 1     1    25
#> 2     1    28
#> 3     1    29
#> 4     1    30
#> 5     1    31
#> 6     1    32
#> # ℹ 157 more rows
#> 
to_looped(create_ring(4))
to_simplified(ison_koenigsberg)
#> ── # Seven Bridges of Koenigsberg ──────────────────────────────────────────────
#> # A labelled, undirected network of 4 landmasses and 5 bridge ties
#> # Transformed by aggregation: parallel ties (max)
#> 
#> ── Nodes 
#> # A tibble: 4 × 3
#>   label      lat   lon
#>   <chr>    <dbl> <dbl>
#> 1 Altstadt  54.7  20.5
#> 2 Kneiphof  54.7  20.5
#> 3 Lomse     54.7  20.5
#> 4 Vorstadt  54.7  20.5
#> 
#> ── Ties 
#> # A tibble: 5 × 2
#>    from    to
#>   <int> <int>
#> 1     1     2
#> 2     1     3
#> 3     2     3
#> 4     2     4
#> 5     3     4
#>