These functions join a list of networks that each hold the same nodes, one network for each moment, layer, or reporter, into one network. Each tie then records the network it came from in one of its columns: time for a moment, layer for a layer, and by for a reporter. Each reverses one of the to_*s() functions that splits a network along such a dimension.

  • from_times() joins 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() joins a list of network waves into a longitudinal network.

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

  • from_layers() joins 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_aggregated() on the result, or join_ties() for two networks.

  • from_reporters() joins a list of the networks that each reporter reported, named after the reporters, into one cognitive social structure (see is_cognitive()).

Every function here returns the class of the networks in the list: a 'stocnet' from 'stocnet's, a 'tbl_graph' from 'tbl_graph's, an 'igraph' from 'igraph's, a 'network' from 'network's. A list of matrices gives a three-dimensional array, with one slice for each matrix, named after the list, since a matrix has no column in which to record the moment, layer, or reporter of a tie. as_stocnet() reads such an array back, once told what its slices hold.

A tie that a network records as missing stays missing from that network alone, so a node that did not report at one moment, or in one layer, is recorded as not reporting there and nowhere else.

To join networks that are each a part of one network, holding some of its nodes, see from_subgraphs() and from_egos().

from_waves(netlist)

from_slices(netlist, remove.duplicates = FALSE)

from_times(netlist)

from_layers(..., layer_names)

from_ties(..., layer_names)

from_reporters(netlist)

Arguments

netlist

A list of network, igraph, tidygraph, matrix, or edgelist objects, over the same nodes.

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 none of them is and they are the same size. Unlabelled nodes are otherwise added as new nodes, with a warning, since which of the other nodes they are would be a guess.

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.

from_reporters() takes the reporter of each network from the names of the list, which may be the labels of the nodes or their positions. Where the list is not named, the networks are taken to be the reports of the first nodes, in order.

Examples

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     1     2     1
#> 2     2     5     1
#> 3     6     7     1
#> 4     2     3     2
#> 5     3     4     2
#> 6     3     6     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, 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))
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
#> 
reports <- list(A = create_ring(4), B = create_star(4))
from_reporters(lapply(reports, add_node_attribute, "name", LETTERS[1:4]))
#> ── # Ring network ──────────────────────────────────────────────────────────────
#> # A labelled, undirected cognitive social structure of 4 nodes and 7 ties from
#> 2 reporters
#> 
#> ── Nodes 
#> # A tibble: 4 × 1
#>   name 
#>   <chr>
#> 1 A    
#> 2 B    
#> 3 C    
#> 4 D    
#> 
#> ── Ties 
#> # A tibble: 7 × 3
#>    from    to by   
#>   <int> <int> <chr>
#> 1     1     2 A    
#> 2     2     3 A    
#> 3     3     4 A    
#> 4     1     4 A    
#> 5     1     2 B    
#> 6     1     3 B    
#> # ℹ 1 more row
#>