These functions reformat manynet-consistent data.

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

  • to_simplex() reformats complex network data, containing loops, to simplex network data, without any loops.

  • to_uniplex() reformats multiplex network data to a single type of tie.

If the format condition is not met, for example to_undirected() is used on a network that is already undirected, 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_simplex(.data)

to_uniplex(.data, tie)

Arguments

.data

An object of a {manynet}-consistent class:

  • matrix (adjacency or incidence) from {base} R

  • edgelist, a data frame from {base} R or tibble from {tibble}

  • igraph, from the {igraph} package

  • network, from the {network} package

  • tbl_graph, from the {tidygraph} package

tie

Character string naming a tie attribute to retain from a graph.

Value

A tidygraph object modified as explained in the function description, details, or section.

Details

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

           data.frame igraph matrix network tbl_graph
to_anti             *      *      *       *         *
to_simplex          *      *      *       *         *
to_uniplex          *      *      *       *         *

Examples

to_anti(ison_southern_women)
#> # A labelled, two-mode network of 18 nodes and 14 nodes and 163 ties
#> 
#> ── Nodes 
#> # A tibble: 32 × 2
#>   type  name     
#>   <lgl> <chr>    
#> 1 FALSE Evelyn   
#> 2 FALSE Laura    
#> 3 FALSE Theresa  
#> 4 FALSE Brenda   
#> 5 FALSE Charlotte
#> 6 FALSE Frances  
#> # ℹ 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
#> 
as_tidygraph(create_filled(5)) |>
  mutate_ties(type = sample(c("friend", "enemy"), 10, replace = TRUE)) |>
  to_uniplex("friend")
#> ── # Filled network ────────────────────────────────────────────────────────────
#> # A undirected network of 5 nodes and 4 friend ties
#> 
#> ── Ties 
#> # A tibble: 4 × 2
#>    from    to
#>   <int> <int>
#> 1     1     2
#> 2     1     5
#> 3     2     5
#> 4     4     5
#>