centrality: Calculate node and edge centrality

Description Usage Arguments Value Functions Examples

Description

The centrality of a node measures the importance of node in the network. As the concept of importance is ill-defined and dependent on the network and the questions under consideration, many centrality measures exist. tidygraph provides a consistent set of wrappers for all the centrality measures implemented in igraph for use inside dplyr::mutate() and other relevant verbs. All functions provided by tidygraph have a consistent naming scheme and automatically calls the function on the graph, returning a vector with measures ready to be added to the node data. Further tidygraph provides access to the netrankr engine for centrality calculations and define a number of centrality measures based on that, as well as provide a manual mode for specifying more-or-less any centrality score.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
centrality_alpha(weights = NULL, alpha = 1, exo = 1, tol = 1e-07,
  loops = FALSE)

centrality_authority(weights = NULL, scale = TRUE,
  options = igraph::arpack_defaults)

centrality_betweenness(weights = NULL, directed = TRUE,
  cutoff = NULL, nobigint = TRUE, normalized = FALSE)

centrality_power(exponent = 1, rescale = FALSE, tol = 1e-07,
  loops = FALSE)

centrality_closeness(weights = NULL, mode = "out",
  normalized = FALSE, cutoff = NULL)

centrality_eigen(weights = NULL, directed = FALSE, scale = TRUE,
  options = igraph::arpack_defaults)

centrality_hub(weights = NULL, scale = TRUE,
  options = igraph::arpack_defaults)

centrality_pagerank(weights = NULL, directed = TRUE, damping = 0.85,
  personalized = NULL)

centrality_subgraph(loops = FALSE)

centrality_degree(weights = NULL, mode = "out", loops = TRUE,
  normalized = FALSE)

centrality_edge_betweenness(weights = NULL, directed = TRUE,
  cutoff = NULL)

centrality_manual(relation = "dist_sp", aggregation = "sum", ...)

centrality_closeness_harmonic()

centrality_closeness_residual()

centrality_closeness_generalised(alpha)

centrality_integration()

centrality_communicability()

centrality_communicability_odd()

centrality_communicability_even()

centrality_subgraph_odd()

centrality_subgraph_even()

centrality_katz(alpha = NULL)

centrality_betweenness_network(netflowmode = "raw")

centrality_betweenness_current()

centrality_betweenness_communicability()

centrality_betweenness_rsp_simple(rspxparam = 1)

centrality_betweenness_rsp_net(rspxparam = 1)

centrality_information()

centrality_decay(alpha = 1)

centrality_random_walk()

centrality_expected()

Arguments

weights

The weight of the edges to use for the calculation. Will be evaluated in the context of the edge data.

alpha

Relative importance of endogenous vs exogenous factors (centrality_alpha), the exponent to the power transformation of the distance metric (centrality_closeness_generalised), the base of power transformation (centrality_decay), or the attenuation factor (centrality_katz)

exo

The exogenous factors of the nodes. Either a scalar or a number number for each node. Evaluated in the context of the node data.

tol

Tolerance for near-singularities during matrix inversion

loops

Should loops be included in the calculation

scale

Should the output be scaled between 0 and 1

options

Settings passed on to igraph::arpack()

directed

Should direction of edges be used for the calculations

cutoff

maximum path length to use during calculations

nobigint

Should big integers be avoided during calculations

normalized

Should the output be normalized

exponent

The decay rate for the Bonacich power centrality

rescale

Should the output be scaled to sum up to 1

mode

How should edges be followed. Ignored for undirected graphs

damping

The damping factor of the page rank algorithm

personalized

The probability of jumping to a node when abandoning a random walk. Evaluated in the context of the node data.

relation

The indirect relation measure type to be used in netrankr::indirect_relations

aggregation

The aggregation type to use on the indirect relations to be used in netrankr::aggregate_positions

...

Arguments to pass on to netrankr::indirect_relations

netflowmode

The return type of the network flow distance, either 'raw' or 'frac'

rspxparam

inverse temperature parameter

Value

A numeric vector giving the centrality measure of each node.

Functions

Examples

1
2
3
4
5
6
7
8
create_notable('bull') %>%
  activate(nodes) %>%
  mutate(importance = centrality_alpha())

# Most centrality measures are for nodes but not all
create_notable('bull') %>%
  activate(edges) %>%
  mutate(importance = centrality_edge_betweenness())

Example output

Attaching package: 'tidygraph'

The following object is masked from 'package:stats':

    filter

# A tbl_graph: 5 nodes and 5 edges
#
# An undirected simple graph with 1 component
#
# Node Data: 5 x 1 (active)
  importance
       <dbl>
1         -1
2         -1
3         -1
4          0
5          0
#
# Edge Data: 5 x 2
   from    to
  <int> <int>
1     1     2
2     1     3
3     2     3
# ... with 2 more rows
# A tbl_graph: 5 nodes and 5 edges
#
# An undirected simple graph with 1 component
#
# Edge Data: 5 x 3 (active)
   from    to importance
  <int> <int>      <dbl>
1     1     2          2
2     1     3          2
3     2     3          4
4     2     4          4
5     3     5          4
#
# Node Data: 5 x 0

tidygraph documentation built on May 2, 2019, 8:32 a.m.