These functions allow users to add and delete ties:
add_ties() adds additional ties to network data
delete_ties() deletes ties from network data
bind_ties() appends the tie data from two networks
filter_ties() subsets ties based on some tie attribute-related logical statement.
While add_*()/delete_*() functions operate similarly as comparable {igraph} functions,
filter*(), etc work like {tidyverse} or {dplyr}-style functions.
add_ties(.data, ties, attr_list = NULL)
delete_ties(.data, ties)
bind_ties(.data, ...)
filter_ties(.data, ...)An object of a {manynet}-consistent class:
adjacency or incidence matrix from {base} R
edgelist data.frame from {base} R or tbl/tbl_df from {tibble}
stocnet stocnet, from the {manynet} package
igraph igraph, from the {igraph} package
network network, from the {network} package
tidygraph tbl_graph, from the {tidygraph} package
The number of ties to be added or an even list of ties.
A list of attributes to be added to the new ties.
Additional parameters and arguments passed on internally.
A data object of the same class as the function was given.
Not all functions have methods available for all object classes. Below are the currently implemented S3 methods for these functions:
default igraph network stocnet tbl_graph
add_ties * * * *
bind_ties * * *
delete_ties * * * *
filter_ties * * * *If a method is not available for a particular class, but a default method is, the default method will attempt to coerce the object to a class for which a method is defined, and then coerce the output back to the original class. If no method is available for any class, an error will be thrown.
Other ties:
manip_ties_attr,
modif_direction,
modif_weight
Other manipulations:
manip_changes,
manip_global,
manip_info,
manip_nodes_attr,
manip_nodes_num,
manip_ties_attr
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
#>
#> ── Nodes
#> # A tibble: 4 × 1
#> name
#> <chr>
#> 1 A
#> 2 B
#> 3 C
#> 4 D
#>
#> ── Ties
#> # 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
#>
#> ── Nodes
#> # A tibble: 4 × 1
#> name
#> <chr>
#> 1 A
#> 2 B
#> 3 C
#> 4 D
#>
#> ── Ties
#> # 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"))
#> ── # The Adolescent Society ────────────────────────────────────────────────────
#> # A labelled, undirected network of 8 adolescents and 11 friendships ties
#>
#> ── 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: 11 × 2
#> from to
#> <int> <int>
#> 1 1 2
#> 2 2 3
#> 3 3 4
#> 4 2 5
#> 5 3 5
#> 6 4 5
#> # ℹ 5 more rows
#>
delete_ties(ison_adolescents, 3)
#> ── # The Adolescent Society ────────────────────────────────────────────────────
#> # A labelled, undirected network of 8 adolescents and 9 friendships ties
#>
#> ── 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: 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
#>
#> ── 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: 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
#>