These functions join a list of networks that are each a part of one
network, holding some of its nodes and the ties among them,
back into that one network.
Each reverses one of the to_*s() functions that splits a network into
parts.
from_subgraphs() joins a list of subgraphs, as to_subgraphs()
returns, into one network.
from_egos() joins a list of ego networks, as to_egos() returns,
into one whole network.
A node or a tie that more than one part holds is held once in the result.
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, and a single matrix from matrices, since the parts are all of one network.
To stack networks that each hold the same nodes, one for each moment,
layer, or reporter, see from_times() and the other functions there.
from_subgraphs(netlist)
from_egos(netlist)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.
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 3 ties
#>
#> ── Nodes
#> # A tibble: 8 × 3
#> name unicorn.x unicorn.y
#> <chr> <chr> <chr>
#> 1 Betty no NA
#> 2 Dale no NA
#> 3 Pam no NA
#> 4 Sue NA yes
#> 5 Alice NA yes
#> 6 Jane NA yes
#> # ℹ 2 more rows
#>
#> ── Ties
#> # A tibble: 3 × 2
#> from to
#> <int> <int>
#> 1 4 5
#> 2 5 6
#> 3 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
#>