These functions offer tools for splitting manynet-consistent objects (matrices, igraph, tidygraph, or network objects) into lists of networks.

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

data.framediff_modeligraphmatrixnetworktbl_graph
to_components101111
to_egos101111
to_slices001001
to_subgraphs001011
to_waves111001
to_egos(.data, max_dist = 1, min_dist = 0)

to_subgraphs(.data, attribute)

to_components(.data)

to_waves(.data, attribute = "wave", panels = NULL, cumulative = FALSE)

to_slices(.data, attribute = "time", slice = NULL)

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

max_dist

The maximum breadth of the neighbourhood. By default 1.

min_dist

The minimum breadth of the neighbourhood. By default 0. Increasing this to 1 excludes the ego, and 2 excludes ego's direct alters.

attribute

One or two attributes used to slice data.

panels

Would you like to select certain waves? NULL by default. That is, a list of networks for every available wave is returned. Users can also list specific waves they want to select.

cumulative

Whether to make wave ties cumulative. FALSE by default. That is, each wave is treated isolated.

slice

Character string or character list indicating the date(s) or integer(s) range used to slice data (e.g slice = c(1:2, 3:4)).

Value

The returned object will be a list of network objects.

Functions

  • to_egos(): Returns a list of ego (or focal) networks.

  • to_subgraphs(): Returns a list of subgraphs on some given node attribute.

  • to_components(): Returns a list of the components in a network.

  • to_waves(): Returns a network with some discrete observations over time into a list of those observations.

  • to_slices(): Returns a list of a network with some continuous time variable at some time slice(s).

See also

Examples

  to_egos(ison_adolescents)
#> $Betty
#> # A labelled, undirected network with 2 nodes and 1 ties
#> # A tibble: 2 × 1
#>   name 
#>   <chr>
#> 1 Betty
#> 2 Sue  
#> # A tibble: 1 × 2
#>    from    to
#>   <int> <int>
#> 1     1     2
#> 
#> $Sue
#> # A labelled, undirected network with 5 nodes and 6 ties
#> # A tibble: 5 × 1
#>   name 
#>   <chr>
#> 1 Betty
#> 2 Sue  
#> 3 Alice
#> 4 Dale 
#> 5 Pam  
#> # A tibble: 6 × 2
#>    from    to
#>   <int> <int>
#> 1     1     2
#> 2     2     3
#> 3     2     4
#> 4     3     4
#> 5     2     5
#> 6     3     5
#> 
#> $Alice
#> # A labelled, undirected network with 5 nodes and 7 ties
#> # A tibble: 5 × 1
#>   name 
#>   <chr>
#> 1 Sue  
#> 2 Alice
#> 3 Jane 
#> 4 Dale 
#> 5 Pam  
#> # A tibble: 7 × 2
#>    from    to
#>   <int> <int>
#> 1     1     2
#> 2     2     3
#> 3     1     4
#> 4     2     4
#> 5     3     4
#> 6     1     5
#> # ℹ 1 more row
#> 
#> $Jane
#> # A labelled, undirected network with 3 nodes and 3 ties
#> # A tibble: 3 × 1
#>   name 
#>   <chr>
#> 1 Alice
#> 2 Jane 
#> 3 Dale 
#> # A tibble: 3 × 2
#>    from    to
#>   <int> <int>
#> 1     1     2
#> 2     1     3
#> 3     2     3
#> 
#> $Dale
#> # A labelled, undirected network with 4 nodes and 5 ties
#> # A tibble: 4 × 1
#>   name 
#>   <chr>
#> 1 Sue  
#> 2 Alice
#> 3 Jane 
#> 4 Dale 
#> # A tibble: 5 × 2
#>    from    to
#>   <int> <int>
#> 1     1     2
#> 2     2     3
#> 3     1     4
#> 4     2     4
#> 5     3     4
#> 
#> $Pam
#> # A labelled, undirected network with 4 nodes and 4 ties
#> # A tibble: 4 × 1
#>   name 
#>   <chr>
#> 1 Sue  
#> 2 Alice
#> 3 Pam  
#> 4 Carol
#> # A tibble: 4 × 2
#>    from    to
#>   <int> <int>
#> 1     1     2
#> 2     1     3
#> 3     2     3
#> 4     3     4
#> 
#> $Carol
#> # A labelled, undirected network with 3 nodes and 2 ties
#> # A tibble: 3 × 1
#>   name 
#>   <chr>
#> 1 Pam  
#> 2 Carol
#> 3 Tina 
#> # A tibble: 2 × 2
#>    from    to
#>   <int> <int>
#> 1     1     2
#> 2     2     3
#> 
#> $Tina
#> # A labelled, undirected network with 2 nodes and 1 ties
#> # A tibble: 2 × 1
#>   name 
#>   <chr>
#> 1 Carol
#> 2 Tina 
#> # A tibble: 1 × 2
#>    from    to
#>   <int> <int>
#> 1     1     2
#> 
  #autographs(to_egos(ison_adolescents,2))
ison_adolescents %>%
  mutate(unicorn = sample(c("yes", "no"), 8,
                          replace = TRUE)) %>%
  to_subgraphs(attribute = "unicorn")
#> [[1]]
#> # A labelled, undirected network with 4 nodes and 2 ties
#> # A tibble: 4 × 2
#>   name  unicorn
#>   <chr> <chr>  
#> 1 Betty no     
#> 2 Sue   no     
#> 3 Alice no     
#> 4 Carol no     
#> # A tibble: 2 × 2
#>    from    to
#>   <int> <int>
#> 1     1     2
#> 2     2     3
#> 
#> [[2]]
#> # A labelled, undirected network with 4 nodes and 1 ties
#> # A tibble: 4 × 2
#>   name  unicorn
#>   <chr> <chr>  
#> 1 Jane  yes    
#> 2 Dale  yes    
#> 3 Pam   yes    
#> 4 Tina  yes    
#> # A tibble: 1 × 2
#>    from    to
#>   <int> <int>
#> 1     1     2
#> 
  to_components(ison_marvel_relationships)
#> [[1]]
#> # A labelled, complex, multiplex, signed, undirected network with 50 nodes and 558 ties
#> # A tibble: 50 × 10
#>   name     Gender Appearances Attractive  Rich Intellect Omnilingual PowerOrigin
#>   <chr>    <chr>        <int>      <int> <int>     <int>       <int> <chr>      
#> 1 Abomina… Male           427          0     0         1           1 Radiation  
#> 2 Ant-Man  Male           589          1     0         1           0 Human      
#> 3 Apocaly… Male          1207          0     0         1           1 Mutant     
#> 4 Beast    Male          7609          1     0         1           0 Mutant     
#> 5 Black P… Male          2189          1     1         1           0 Human      
#> 6 Black W… Female        2907          1     0         1           0 Human      
#> # ℹ 44 more rows
#> # ℹ 2 more variables: UnarmedCombat <int>, ArmedCombat <int>
#> # A tibble: 558 × 3
#>    from    to  sign
#>   <int> <int> <dbl>
#> 1     1     4    -1
#> 2     1    10    -1
#> 3     1    11    -1
#> 4     1    22    -1
#> 5     1    23    -1
#> 6     1    24    -1
#> # ℹ 552 more rows
#> 
#> [[2]]
#> # A labelled, signed, undirected network with 1 nodes and 0 ties
#> # A tibble: 1 × 10
#>   name  Gender Appearances Attractive  Rich Intellect Omnilingual PowerOrigin
#>   <chr> <chr>        <int>      <int> <int>     <int>       <int> <chr>      
#> 1 Cable Male          2734          0     0         1           0 Mutant     
#> # ℹ 2 more variables: UnarmedCombat <int>, ArmedCombat <int>
#> # A tibble: 0 × 3
#> # ℹ 3 variables: from <int>, to <int>, sign <dbl>
#> 
#> [[3]]
#> # A labelled, signed, undirected network with 1 nodes and 0 ties
#> # A tibble: 1 × 10
#>   name     Gender Appearances Attractive  Rich Intellect Omnilingual PowerOrigin
#>   <chr>    <chr>        <int>      <int> <int>     <int>       <int> <chr>      
#> 1 Iron Fi… Male          1789          0     1         1           0 Human      
#> # ℹ 2 more variables: UnarmedCombat <int>, ArmedCombat <int>
#> # A tibble: 0 × 3
#> # ℹ 3 variables: from <int>, to <int>, sign <dbl>
#> 
#> [[4]]
#> # A labelled, signed, undirected network with 1 nodes and 0 ties
#> # A tibble: 1 × 10
#>   name     Gender Appearances Attractive  Rich Intellect Omnilingual PowerOrigin
#>   <chr>    <chr>        <int>      <int> <int>     <int>       <int> <chr>      
#> 1 Luke Ca… Male          2466          0     0         0           0 Human      
#> # ℹ 2 more variables: UnarmedCombat <int>, ArmedCombat <int>
#> # A tibble: 0 × 3
#> # ℹ 3 variables: from <int>, to <int>, sign <dbl>
#> 
ison_adolescents %>%
  mutate_ties(wave = sample(1995:1998, 10, replace = TRUE)) %>%
  to_waves(attribute = "wave")
#> $`1995`
#> # A longitudinal, labelled, undirected network with 8 nodes and 2 ties
#> # A tibble: 8 × 1
#>   name 
#>   <chr>
#> 1 Betty
#> 2 Sue  
#> 3 Alice
#> 4 Jane 
#> 5 Dale 
#> 6 Pam  
#> # ℹ 2 more rows
#> # A tibble: 2 × 3
#>    from    to  wave
#>   <int> <int> <int>
#> 1     1     2  1995
#> 2     2     3  1995
#> 
#> $`1998`
#> # A longitudinal, labelled, undirected network with 8 nodes and 5 ties
#> # A tibble: 8 × 1
#>   name 
#>   <chr>
#> 1 Betty
#> 2 Sue  
#> 3 Alice
#> 4 Jane 
#> 5 Dale 
#> 6 Pam  
#> # ℹ 2 more rows
#> # A tibble: 5 × 3
#>    from    to  wave
#>   <int> <int> <int>
#> 1     3     4  1998
#> 2     2     5  1998
#> 3     4     5  1998
#> 4     2     6  1998
#> 5     7     8  1998
#> 
#> $`1996`
#> # A longitudinal, labelled, undirected network with 8 nodes and 2 ties
#> # A tibble: 8 × 1
#>   name 
#>   <chr>
#> 1 Betty
#> 2 Sue  
#> 3 Alice
#> 4 Jane 
#> 5 Dale 
#> 6 Pam  
#> # ℹ 2 more rows
#> # A tibble: 2 × 3
#>    from    to  wave
#>   <int> <int> <int>
#> 1     3     5  1996
#> 2     6     7  1996
#> 
#> $`1997`
#> # A longitudinal, labelled, undirected network with 8 nodes and 1 ties
#> # A tibble: 8 × 1
#>   name 
#>   <chr>
#> 1 Betty
#> 2 Sue  
#> 3 Alice
#> 4 Jane 
#> 5 Dale 
#> 6 Pam  
#> # ℹ 2 more rows
#> # A tibble: 1 × 3
#>    from    to  wave
#>   <int> <int> <int>
#> 1     3     6  1997
#> 
ison_adolescents %>%
  mutate_ties(time = 1:10, increment = 1) %>% 
  add_ties(c(1,2), list(time = 3, increment = -1)) %>% 
  to_slices(slice = 7)
#> # A labelled, weighted, undirected network with 8 nodes and 6 ties
#> # A tibble: 8 × 1
#>   name 
#>   <chr>
#> 1 Betty
#> 2 Sue  
#> 3 Alice
#> 4 Jane 
#> 5 Dale 
#> 6 Pam  
#> # ℹ 2 more rows
#> # A tibble: 6 × 3
#>    from    to weight
#>   <int> <int>  <dbl>
#> 1     2     3      1
#> 2     3     4      1
#> 3     2     5      1
#> 4     3     5      1
#> 5     4     5      1
#> 6     2     6      1