These functions offer tools for transforming manynet-consistent objects (matrices, igraph, tidygraph, or network objects). Transforming means that the returned object may have different dimensions than the original object.
to_ego() scopes a network into the local neighbourhood of a given node.
to_giant() scopes a network into one including only the main component and no smaller components or isolates.
to_no_isolates() scopes a network into one excluding all nodes without ties.
to_no_missing() scopes a network to one retaining only complete cases,
i.e. nodes with no missing values.
to_subgraph() scopes a network into a subgraph by filtering on some node-related logical statement.
to_blocks() reduces a network to ties between a given partition membership vector.
to_no_missing(.data)
to_ego(.data, node, max_dist = 1, min_dist = 0, direction = c("out", "in"))
to_time(.data, time)
to_giant(.data)
to_no_isolates(.data)
to_subgraph(.data, ...)
to_blocks(.data, membership, FUN = mean)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
Name or index of node.
The maximum breadth of the neighbourhood. By default 1.
The minimum breadth of the neighbourhood. By default 0. Increasing this to 1 excludes the ego, and 2 excludes ego's direct alters.
Character string, “out” bases the measure on outgoing ties, “in” on incoming ties, and "all" on either/the sum of the two. By default "all".
A time point or wave at which to present the network.
Arguments passed on to dplyr::filter
A vector of partition memberships.
A function for summarising block content.
By default mean.
Other recommended options include median, sum,
min or max.
A tidygraph object modified as explained in the function description, details, or section.
Not all functions have methods available for all object classes. Below are the currently implemented S3 methods:
to_blocks()Reduced graphs provide summary representations of network structures by collapsing groups of connected nodes into single nodes while preserving the topology of the original structures.
Other modifications:
modif_correlation,
modif_direction,
modif_from,
modif_labels,
modif_levels,
modif_miss,
modif_paths,
modif_permutation,
modif_plexity,
modif_project,
modif_split,
modif_weight
ison_adolescents |>
mutate_ties(wave = sample(1995:1998, 10, replace = TRUE)) |>
to_waves(attribute = "wave") |>
to_no_isolates()
#> $`1995`
#>
#> ── # The Adolescent Society ────────────────────────────────────────────────────
#> # A longitudinal, labelled, undirected network of 6 adolescents and 4
#> friendships ties over 1995 waves
#>
#> ── Nodes
#> # A tibble: 6 × 1
#> name
#> <chr>
#> 1 Sue
#> 2 Alice
#> 3 Dale
#> 4 Pam
#> 5 Carol
#> 6 Tina
#>
#> ── Ties
#> # A tibble: 4 × 3
#> from to wave
#> <int> <int> <int>
#> 1 1 3 1995
#> 2 2 4 1995
#> 3 4 5 1995
#> 4 5 6 1995
#>
#>
#> $`1996`
#> ── # The Adolescent Society ────────────────────────────────────────────────────
#> # A longitudinal, labelled, undirected network of 6 adolescents and 5
#> friendships ties over 1996 waves
#>
#> ── Nodes
#> # A tibble: 6 × 1
#> name
#> <chr>
#> 1 Betty
#> 2 Sue
#> 3 Alice
#> 4 Jane
#> 5 Dale
#> 6 Pam
#>
#> ── Ties
#> # A tibble: 5 × 3
#> from to wave
#> <int> <int> <int>
#> 1 1 2 1996
#> 2 3 4 1996
#> 3 3 5 1996
#> 4 4 5 1996
#> 5 2 6 1996
#>
#>
#> $`1998`
#> ── # The Adolescent Society ────────────────────────────────────────────────────
#> # A longitudinal, labelled, undirected network of 2 adolescents and 1
#> friendships ties over 1998 waves
#>
#> ── Nodes
#> # A tibble: 2 × 1
#> name
#> <chr>
#> 1 Sue
#> 2 Alice
#>
#> ── Ties
#> # A tibble: 1 × 3
#> from to wave
#> <int> <int> <int>
#> 1 1 2 1998
#>
#>