These functions offer tools for joining lists of manynet-consistent objects (matrices, igraph, tidygraph, or network objects) into a single object.

  • from_subgraphs() modifies a list of subgraphs into a single tidygraph.

  • from_egos() modifies a list of ego networks into a whole tidygraph

  • from_waves() modifies a list of network waves into a longitudinal tidygraph.

  • from_slices() modifies a list of time slices of a network into a dynamic tidygraph.

  • from_ties() modifies a list of different ties into a multiplex tidygraph

from_subgraphs(netlist)

from_egos(netlist)

from_waves(netlist)

from_slices(netlist, remove.duplicates = FALSE)

from_ties(..., layer_names)

Arguments

netlist

A list of network, igraph, tidygraph, matrix, or edgelist objects.

remove.duplicates

Should duplicates be removed? By default FALSE. If TRUE, duplicated edges are removed.

...

Two or more tidygraph or stocnet objects to be merged, each representing a different set of ties to be combined into a single multiplex network.

layer_names

A character vector of names for the different network objects, if not already named within the list.

Value

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

Examples

ison_adolescents |>
  mutate(unicorn = sample(c("yes", "no"), 8, replace = TRUE)) |>
  to_subgraphs(attribute = "unicorn") |>
  from_subgraphs()
#> # A labelled, undirected network of 8 nodes and 5 ties
#> 
#> ── Nodes 
#> # A tibble: 8 × 3
#>   name  unicorn.x unicorn.y
#>   <chr> <chr>     <chr>    
#> 1 Betty yes       NA       
#> 2 Sue   yes       NA       
#> 3 Jane  yes       NA       
#> 4 Dale  yes       NA       
#> 5 Tina  yes       NA       
#> 6 Alice NA        no       
#> # ℹ 2 more rows
#> 
#> ── Ties 
#> # A tibble: 5 × 2
#>    from    to
#>   <int> <int>
#> 1     1     2
#> 2     2     4
#> 3     3     4
#> 4     6     7
#> 5     7     8
#> 
ison_adolescents |>
  to_egos() |>
  from_egos()
#> # A labelled, directed network of 8 nodes and 10 arcs
#> 
#> ── Nodes 
#> # A tibble: 8 × 1
#>   name 
#>   <chr>
#> 1 Betty
#> 2 Sue  
#> 3 Alice
#> 4 Jane 
#> 5 Pam  
#> 6 Carol
#> # ℹ 2 more rows
#> 
#> ── Ties 
#> # A tibble: 10 × 2
#>    from    to
#>   <int> <int>
#> 1     1     2
#> 2     2     3
#> 3     2     7
#> 4     3     7
#> 5     2     5
#> 6     3     5
#> # ℹ 4 more rows
#> 
ison_adolescents |>
  mutate_ties(wave = sample(1:4, 10, replace = TRUE)) |>
  to_waves(attribute = "wave") |>
  from_waves()
#> # A longitudinal, labelled, directed network of 8 nodes and 10 arcs over 4
#> waves
#> 
#> ── Nodes 
#> # A tibble: 8 × 1
#>   name 
#>   <chr>
#> 1 Betty
#> 2 Sue  
#> 3 Alice
#> 4 Jane 
#> 5 Dale 
#> 6 Pam  
#> # ℹ 2 more rows
#> 
#> ── Ties 
#> # A tibble: 10 × 3
#>    from    to  wave
#>   <int> <int> <int>
#> 1     3     6     1
#> 2     6     7     1
#> 3     7     8     1
#> 4     2     3     2
#> 5     3     4     2
#> 6     2     5     2
#> # ℹ 4 more rows
#> 
ison_adolescents |>
  mutate_ties(time = 1:10, increment = 1) |> 
  add_ties(c(1,2), list(time = 3, increment = -1)) |> 
  to_slices(slice = c(5,7)) |>
  from_slices()
#> # A labelled, weighted, directed network of 8 nodes and 10 arcs
#> 
#> ── Nodes 
#> # A tibble: 8 × 1
#>   name 
#>   <chr>
#> 1 Betty
#> 2 Sue  
#> 3 Alice
#> 4 Jane 
#> 5 Dale 
#> 6 Pam  
#> # ℹ 2 more rows
#> 
#> ── Ties 
#> # A tibble: 10 × 3
#>    from    to weight
#>   <int> <int>  <dbl>
#> 1     2     3      1
#> 2     3     4      1
#> 3     2     5      1
#> 4     3     5      1
#> 5     2     3      1
#> 6     3     4      1
#> # ℹ 4 more rows
#>