local_graph {tidygraph}R Documentation

Measures based on the neighborhood of each node

Description

These functions wraps a set of functions that all measures quantities of the local neighborhood of each node. They all return a vector or list matching the node position.

Usage

local_size(order = 1, mode = "all", mindist = 0)

local_members(order = 1, mode = "all", mindist = 0)

local_triangles()

local_ave_degree(weights = NULL)

local_transitivity(weights = NULL)

Arguments

order

Integer giving the order of the neighborhood.

mode

Character constatnt, it specifies how to use the direction of the edges if a directed graph is analyzed. For ‘out’ only the outgoing edges are followed, so all vertices reachable from the source vertex in at most order steps are counted. For ‘"in"’ all vertices from which the source vertex is reachable in at most order steps are counted. ‘"all"’ ignores the direction of the edges. This argument is ignored for undirected graphs.

mindist

The minimum distance to include the vertex in the result.

weights

Weight vector. If the graph has a weight edge attribute, then this is used by default. If this argument is given, then vertex strength (see strength) is used instead of vertex degree. But note that knnk is still given in the function of the normal vertex degree.

Value

A numeric vector or a list (for local_members) with elements corresponding to the nodes in the graph.

Functions

Examples

# Get all neighbors of each graph
create_notable('chvatal') %>%
  activate(nodes) %>%
  mutate(neighborhood = local_members(mindist = 1))

# These are equivalent
create_notable('chvatal') %>%
  activate(nodes) %>%
  mutate(n_neighbors = local_size(mindist = 1),
         degree = centrality_degree()) %>%
  as_tibble()


[Package tidygraph version 1.0.0 Index]