These functions offer tools for joining lists of manynet-consistent objects (matrices, igraph, tidygraph, or network objects) into a single object. Each reverses one of the to_*s() functions that splits a network apart.

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

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

  • from_times() modifies a list of the network at each moment, as to_times() returns, back into one network that records time. This is where new work on rejoining a network over time belongs; from_waves() and from_slices() are the older, form-specific spellings.

  • 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_layers() modifies several networks over the same nodes into one multiplex network, keeping each as its own layer. from_ties() is an alias. Where to_layers() splits a multiplex network into its layers, from_layers() reassembles them. To combine the networks' tie values into a single value per dyad instead, use to_flat() on the result, or join_ties() for two networks.

from_subgraphs(netlist)

from_egos(netlist)

from_waves(netlist)

from_slices(netlist, remove.duplicates = FALSE)

from_times(netlist)

from_layers(..., layer_names)

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 networks over the same nodes to be merged, or a single list of such networks, such as that returned by to_layers(). Nodes are matched by name where the networks are labelled, and by position where they are not and are the same size.

layer_names

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

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

from_times() rejoins what to_times() returns, stamping each network's ties with the moment it names before binding them, and so inverts it for a network that stamps its moments. Where the networks carry the interval each tie lasts over, the moment is already in those ties, so they are bound and deduplicated rather than stamped again.

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 no        NA       
#> 2 Alice no        NA       
#> 3 Sue   NA        yes      
#> 4 Jane  NA        yes      
#> 5 Dale  NA        yes      
#> 6 Pam   NA        yes      
#> # ℹ 2 more rows
#> 
#> ── Ties 
#> # A tibble: 5 × 2
#>    from    to
#>   <int> <int>
#> 1     3     5
#> 2     3     6
#> 3     4     5
#> 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     2     3     1
#> 2     3     4     2
#> 3     2     6     2
#> 4     3     6     2
#> 5     6     7     2
#> 6     3     5     3
#> # ℹ 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, directed network of 8 nodes and 10 arcs (8 parallel)
#> 
#> ── 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
#> 
from_times(to_times(ison_tailorshop))
#> ── # Kapferer's Tailor Shop ────────────────────────────────────────────────────
#> # A longitudinal, labelled, multiplex, directed network of 39 workers and 256
#> instrumental arcs and 381 sociational ties over 2 waves
#> 
#> ── Nodes 
#> # A tibble: 39 × 1
#>   label   
#>   <chr>   
#> 1 Kamwefu 
#> 2 Nkumbula
#> 3 Abraham 
#> 4 Seams   
#> 5 Chipata 
#> 6 Donald  
#> # ℹ 33 more rows
#> 
#> ── Ties 
#> # A tibble: 637 × 4
#>    from    to layer         time
#>   <int> <int> <chr>        <int>
#> 1     3     1 instrumental     1
#> 2     4     1 instrumental     1
#> 3    14     1 instrumental     1
#> 4    11     2 instrumental     1
#> 5    12     2 instrumental     1
#> 6     1     3 instrumental     1
#> # ℹ 631 more rows
#> 
marriage <- to_uniplex(ison_florentine, "marriage")
business <- to_uniplex(ison_florentine, "business")
from_layers(marriage = marriage, business = business)
#> ── # marriage + business ───────────────────────────────────────────────────────
#> # A labelled, multiplex, undirected network of 16 families and 20 marriage ties
#> and 15 business ties
#> 
#> ── Nodes 
#> # A tibble: 16 × 4
#>   label      wealth priorates totalties
#>   <chr>       <int>     <int>     <int>
#> 1 Acciaiuoli     10        53         2
#> 2 Albizzi        36        65         3
#> 3 Barbadori      55         0        14
#> 4 Bischeri       44        12         9
#> 5 Castellani     20        22        18
#> 6 Ginori         32         0         9
#> # ℹ 10 more rows
#> 
#> ── Ties 
#> # A tibble: 35 × 3
#>    from    to layer   
#>   <int> <int> <chr>   
#> 1     3     5 marriage
#> 2     2     6 marriage
#> 3     2     7 marriage
#> 4     4     7 marriage
#> 5     7     8 marriage
#> 6     1     9 marriage
#> # ℹ 29 more rows
#>