manip_scope function

Modifying networks scope

Modifying networks scope

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_giant(.data) to_no_isolates(.data) to_subgraph(.data, ...) to_blocks(.data, membership, FUN = mean)

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
  • node: Name or index of node.

  • 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.

  • direction: String, either "out" or "in".

  • ...: Arguments passed on to dplyr::filter

  • membership: A vector of partition memberships.

  • FUN: A function for summarising block content. By default mean. Other recommended options include median, sum, min or max.

Returns

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.

Details

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

data.frameigraphlistmatrixnetworktbl_graph
to_blocks110111
to_ego010001
to_giant110111
to_no_isolates111111
to_subgraph110111

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.

Examples

ison_adolescents %>% mutate_ties(wave = sample(1995:1998, 10, replace = TRUE)) %>% to_waves(attribute = "wave") %>% to_no_isolates()

See Also

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

  • Maintainer: James Hollway
  • License: MIT + file LICENSE
  • Last published: 2024-11-05