These functions allow users to add and delete ties and their attributes:

  • add_ties() adds additional ties to network data

  • delete_ties() deletes ties from network data

  • add_tie_attribute() and mutate_ties() offer ways to add a vector of values to a network as a tie attribute.

  • rename_ties() renames tie attributes.

  • bind_ties() appends the tie data from two networks and join_ties() merges ties from two networks, adding a tie attribute identifying the newly added ties.

  • filter_ties() subsets ties based on some tie attribute-related logical statement.

Note that while add_*()/delete_*() functions operate similarly as comparable {igraph} functions, mutate*(), bind*(), etc work like {tidyverse} or {dplyr}-style functions.

add_ties(.data, ties, attribute = NULL)

delete_ties(.data, ties)

add_tie_attribute(.data, attr_name, vector)

mutate_ties(.data, ...)

rename_ties(.data, ...)

arrange_ties(.data, ...)

bind_ties(.data, ...)

join_ties(.data, object2, attr_name)

filter_ties(.data, ...)

select_ties(.data, ...)

summarise_ties(.data, ...)

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

ties

The number of ties to be added or an even list of ties.

attribute

A named list to be added as tie or node attributes.

attr_name

Name of the new attribute in the resulting object.

vector

A vector of values for the new attribute.

...

Additional arguments.

object2

A second object to copy nodes or ties from.

Value

A tidygraph (tbl_graph) data object.

Examples

  other <- create_filled(4) %>% mutate(name = c("A", "B", "C", "D"))
  mutate_ties(other, form = 1:6) %>% filter_ties(form < 4)
#> # Filled network
#> # A labelled, multiplex, undirected network of 4 nodes and 3 ties
#> # A tibble: 4 × 1
#>   name 
#>   <chr>
#> 1 A    
#> 2 B    
#> 3 C    
#> 4 D    
#> # A tibble: 3 × 3
#>    from    to  form
#>   <int> <int> <int>
#> 1     1     2     1
#> 2     1     3     2
#> 3     1     4     3
  add_tie_attribute(other, "weight", c(1, 2, 2, 2, 1, 2))
#> # Filled network
#> # A labelled, weighted, undirected network of 4 nodes and 6 ties
#> # A tibble: 4 × 1
#>   name 
#>   <chr>
#> 1 A    
#> 2 B    
#> 3 C    
#> 4 D    
#> # A tibble: 6 × 3
#>    from    to weight
#>   <int> <int>  <dbl>
#> 1     1     2      1
#> 2     1     3      2
#> 3     1     4      2
#> 4     2     3      2
#> 5     2     4      1
#> 6     3     4      2
ison_adolescents %>% add_ties(c("Betty","Tina")) %>% graphr()

delete_ties(ison_adolescents, 3)
#> # The Adolescent Society
#> # A labelled, undirected network of 8 adolescents and 9 friendships ties
#> # A tibble: 8 × 1
#>   name 
#>   <chr>
#> 1 Betty
#> 2 Sue  
#> 3 Alice
#> 4 Jane 
#> 5 Dale 
#> 6 Pam  
#> # ℹ 2 more rows
#> # A tibble: 9 × 2
#>    from    to
#>   <int> <int>
#> 1     1     2
#> 2     2     3
#> 3     2     5
#> 4     3     5
#> 5     4     5
#> 6     2     6
#> # ℹ 3 more rows
delete_ties(ison_adolescents, "Alice|Sue")
#> # The Adolescent Society
#> # A labelled, undirected network of 8 adolescents and 9 friendships ties
#> # A tibble: 8 × 1
#>   name 
#>   <chr>
#> 1 Betty
#> 2 Sue  
#> 3 Alice
#> 4 Jane 
#> 5 Dale 
#> 6 Pam  
#> # ℹ 2 more rows
#> # A tibble: 9 × 2
#>    from    to
#>   <int> <int>
#> 1     1     2
#> 2     3     4
#> 3     2     5
#> 4     3     5
#> 5     4     5
#> 6     2     6
#> # ℹ 3 more rows