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_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_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.
String, either "out" or "in".
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
.
All to_
functions return an object of the same class as that provided.
So passing it an igraph object will return an igraph object
and passing it a network object will return a network object,
with certain modifications as outlined for each function.
Not all functions have methods available for all object classes. Below are the currently implemented S3 methods:
data.frame | igraph | list | matrix | network | tbl_graph | |
to_blocks | 1 | 1 | 0 | 1 | 1 | 1 |
to_ego | 0 | 1 | 0 | 0 | 0 | 1 |
to_giant | 1 | 1 | 0 | 1 | 1 | 1 |
to_no_isolates | 1 | 1 | 1 | 1 | 1 | 1 |
to_subgraph | 1 | 1 | 0 | 1 | 1 | 1 |
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:
manip_as
,
manip_correlation
,
manip_deformat
,
manip_from
,
manip_levels
,
manip_miss
,
manip_nodes
,
manip_paths
,
manip_permutation
,
manip_preformat
,
manip_project
,
manip_reformat
,
manip_split
,
manip_ties
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 7 adolescents and 4
#> friendships ties over 1995 waves
#>
#> ── Nodes
#> # A tibble: 7 × 1
#> name
#> <chr>
#> 1 Sue
#> 2 Alice
#> 3 Jane
#> 4 Dale
#> 5 Pam
#> 6 Carol
#> # ℹ 1 more row
#>
#> ── Ties
#> # A tibble: 4 × 3
#> from to wave
#> <int> <int> <int>
#> 1 1 2 1995
#> 2 3 4 1995
#> 3 2 5 1995
#> 4 6 7 1995
#>
#>
#> $`1996`
#> ── # The Adolescent Society ────────────────────────────────────────────────────
#> # A longitudinal, labelled, undirected network of 2 adolescents and 1
#> friendships ties over 1996 waves
#>
#> ── Nodes
#> # A tibble: 2 × 1
#> name
#> <chr>
#> 1 Alice
#> 2 Jane
#>
#> ── Ties
#> # A tibble: 1 × 3
#> from to wave
#> <int> <int> <int>
#> 1 1 2 1996
#>
#>
#> $`1997`
#> ── # The Adolescent Society ────────────────────────────────────────────────────
#> # A longitudinal, labelled, undirected network of 5 adolescents and 3
#> friendships ties over 1997 waves
#>
#> ── Nodes
#> # A tibble: 5 × 1
#> name
#> <chr>
#> 1 Sue
#> 2 Alice
#> 3 Dale
#> 4 Pam
#> 5 Carol
#>
#> ── Ties
#> # A tibble: 3 × 3
#> from to wave
#> <int> <int> <int>
#> 1 1 3 1997
#> 2 2 3 1997
#> 3 4 5 1997
#>
#>
#> $`1998`
#> ── # The Adolescent Society ────────────────────────────────────────────────────
#> # A longitudinal, labelled, undirected network of 3 adolescents and 2
#> friendships ties over 1998 waves
#>
#> ── Nodes
#> # A tibble: 3 × 1
#> name
#> <chr>
#> 1 Betty
#> 2 Sue
#> 3 Pam
#>
#> ── Ties
#> # A tibble: 2 × 3
#> from to wave
#> <int> <int> <int>
#> 1 1 2 1998
#> 2 2 3 1998
#>
#>