These functions calculate common centrality measures for one- and two-mode networks.
All measures attempt to use as much information as they are offered,
including whether the networks are directed, weighted, or multimodal.
If this would produce unintended results,
first transform the salient properties using e.g. `to_undirected()`

functions.
All centrality and centralization measures return normalized measures by default,
including for two-mode networks.

```
node_degree(
object,
normalized = TRUE,
alpha = 0,
direction = c("all", "out", "in")
)
node_closeness(object, normalized = TRUE, direction = "out", cutoff = NULL)
node_betweenness(object, normalized = TRUE, cutoff = NULL)
node_eigenvector(object, normalized = TRUE, scale = FALSE)
node_reach(object, normalized = TRUE, k = 2)
node_power(object, normalized = TRUE, scale = FALSE, exponent = 1)
```

- object
An object of a migraph-consistent class:

matrix (adjacency or incidence) from

`{base}`

Redgelist, a data frame from

`{base}`

R or tibble from`{tibble}`

igraph, from the

`{igraph}`

packagenetwork, from the

`{network}`

packagetbl_graph, from the

`{tidygraph}`

package

- normalized
Logical scalar, whether the centrality scores are normalized. Different denominators are used depending on whether the object is one-mode or two-mode, the type of centrality, and other arguments.

- alpha
Numeric scalar, the positive tuning parameter introduced in Opsahl et al (2010) for trading off between degree and strength centrality measures. By default,

`alpha = 0`

, which ignores tie weights and the measure is solely based upon degree (the number of ties).`alpha = 1`

ignores the number of ties and provides the sum of the tie weights as strength centrality. Values between 0 and 1 reflect different trade-offs in the relative contributions of degree and strength to the final outcome, with 0.5 as the middle ground. Values above 1 penalise for the number of ties. Of two nodes with the same sum of tie weights, the node with fewer ties will obtain the higher score. This argument is ignored except in the case of a weighted network.- direction
Character string, “out” bases the measure on outgoing ties, “in” on incoming ties, and "all" on either/the sum of the two. For two-mode networks, "all" uses as numerator the sum of differences between the maximum centrality score for the mode against all other centrality scores in the network, whereas "in" uses as numerator the sum of differences between the maximum centrality score for the mode against only the centrality scores of the other nodes in that mode.

- cutoff
Maximum path length to use during calculations.

- scale
Logical scalar, whether to rescale the vector so the maximum score is 1.

- k
Integer of steps out to calculate reach

- exponent
Decay rate for the Bonacich power centrality score.

A single centralization score if the object was one-mode, and two centralization scores if the object was two-mode.

Depending on how and what kind of an object is passed to the function,
the function will return a `tidygraph`

object where the nodes have been updated

A numeric vector giving the betweenness centrality measure of each node.

A numeric vector giving the eigenvector centrality measure of each node.

A numeric vector giving each node's power centrality measure.

`node_degree()`

: Calculates the degree centrality of nodes in an unweighted network, or weighted degree/strength of nodes in a weighted network.`node_closeness()`

: Calculate the closeness centrality of nodes in a network`node_betweenness()`

: Calculate the betweenness centralities of nodes in a network`node_eigenvector()`

: Calculate the eigenvector centrality of nodes in a network`node_reach()`

: Calculate nodes' reach centrality or how many nodes they can reach within*k*steps`node_power()`

: Calculate the power centrality of nodes in a network

Faust, Katherine. 1997.
"Centrality in affiliation networks."
*Social Networks* 19(2): 157-191.
doi:10.1016/S0378-8733(96)00300-0
.

Borgatti, Stephen P., and Martin G. Everett. 1997.
"Network analysis of 2-mode data."
*Social Networks* 19(3): 243-270.
doi:10.1016/S0378-8733(96)00301-2
.

Borgatti, Stephen P., and Daniel S. Halgin. 2011.
"Analyzing affiliation networks."
In *The SAGE Handbook of Social Network Analysis*,
edited by John Scott and Peter J. Carrington, 417–33.
London, UK: Sage.
doi:10.4135/9781446294413.n28
.

Opsahl, Tore, Filip Agneessens, and John Skvoretz. 2010.
"Node centrality in weighted networks: Generalizing degree and shortest paths."
*Social Networks* 32, 245-251.
doi:10.1016/j.socnet.2010.03.006

Bonacich, Phillip. 1991.
“Simultaneous Group and Individual Centralities.”
*Social Networks* 13(2):155–68.
doi:10.1016/0378-8733(91)90018-O
.

Bonacich, Phillip. 1987.
“Power and Centrality: A Family of Measures.”
*The American Journal of Sociology*
92(5): 1170–82.
doi:10.1086/228631
.

`to_undirected()`

for removing edge directions
and `to_unweighted()`

for removing weights from a graph.

Other measures:
`centralisation`

,
`closure`

,
`cohesion()`

,
`diversity`

,
`features`

,
`holes`

,
`tie_centrality`

```
node_degree(mpn_elite_mex)
#> Trevino Madero Carranza Aguilar Obregon Calles Alema…¹ Porte…² L. Ca…³ Avila…⁴
#> 1 0.0882 0.176 0.235 0.176 0.176 0.176 0.147 0.235 0.353 0.206
#> # ... with 25 more from this nodeset in the vector.
node_degree(ison_southern_women)
#> EVELYN LAURA THERESA BRENDA CHARLOTTE FRANCES ELEANOR PEARL RUTH VERNE MYRA
#> 1 0.571 0.5 0.571 0.5 0.286 0.286 0.286 0.214 0.286 0.286 0.286
#> # ... with 7 more from this nodeset in the vector.
#> E1 E2 E3 E4 E5 E6 E7 E8 E9 E10 E11 E12 E13
#> 1 0.167 0.167 0.333 0.222 0.444 0.444 0.556 0.778 0.667 0.333 0.222 0.389 0.222
#> # ... with 1 more from this nodeset in the vector.
node_closeness(mpn_elite_mex)
#> Trevino Madero Carranza Aguilar Obregon Calles Alema…¹ Porte…² L. Ca…³ Avila…⁴
#> 1 0.4 0.405 0.466 0.493 0.436 0.459 0.466 0.493 0.586 0.523
#> # ... with 25 more from this nodeset in the vector.
node_closeness(ison_southern_women)
#> EVELYN LAURA THERESA BRENDA CHARLOTTE FRANCES ELEANOR PEARL RUTH VERNE MYRA
#> 1 0.8 0.727 0.8 0.727 0.6 0.667 0.667 0.667 0.706 0.706 0.686
#> # ... with 7 more from this nodeset in the vector.
#> E1 E2 E3 E4 E5 E6 E7 E8 E9 E10 E11 E12 E13
#> 1 0.524 0.524 0.564 0.537 0.595 0.688 0.733 0.846 0.786 0.564 0.537 0.579 0.537
#> # ... with 1 more from this nodeset in the vector.
node_betweenness(mpn_elite_mex)
#> Trevino Madero Carra…¹ Aguilar Obregon Calles Alema…² Porte…³ L. Ca…⁴ Avila…⁵
#> 1 0.00505 0.00819 0.0309 0.0206 0.00806 0.0249 0.00944 0.0389 0.157 0.0204
#> # ... with 25 more from this nodeset in the vector.
node_betweenness(ison_southern_women)
#> V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 V11
#> 1 0.0967 0.0517 0.0876 0.0498 0.0107 0.0108 0.00936 0.00673 0.0167 0.0144 0.0134
#> # ... with 7 more from this nodeset in the vector.
#> V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 V11
#> 1 0.00215 0.00209 0.0181 0.00764 0.0376 0.0620 0.129 0.240 0.213 0.0151 0.0200
#> # ... with 3 more from this nodeset in the vector.
node_eigenvector(mpn_elite_mex)
#> Trevino Madero Carranza Aguilar Obregon Calles Alema…¹ Porte…² L. Ca…³ Avila…⁴
#> 1 0.0808 0.109 0.166 0.170 0.130 0.138 0.140 0.208 0.302 0.253
#> # ... with 25 more from this nodeset in the vector.
node_eigenvector(ison_southern_women)
#> EVELYN LAURA THERESA BRENDA CHARLOTTE FRANCES ELEANOR PEARL RUTH VERNE MYRA
#> 1 0.423 0.397 0.472 0.402 0.227 0.287 0.319 0.264 0.337 0.327 0.292
#> # ... with 7 more from this nodeset in the vector.
#> E1 E2 E3 E4 E5 E6 E7 E8 E9 E10 E11 E12 E13
#> 1 0.215 0.228 0.356 0.261 0.431 0.447 0.522 0.639 0.505 0.323 0.159 0.361 0.251
#> # ... with 1 more from this nodeset in the vector.
node_reach(ison_adolescents)
#> Betty Sue Alice Jane Dale Pam Carol Tina
#> 1 0.429 0.286 0.286 0.286 0.286 0.571 0.286 0.143
node_power(ison_southern_women, exponent = 0.5)
#> EVELYN LAURA THERESA BRENDA CHARLOTTE FRANCES ELEANOR PEARL RUTH VERNE MYRA
#> 1 -1.44 -1.38 -1.44 -1.38 -1.00 -1.38 -1.38 -1.52 -1.44 -1.44 -1.52
#> # ... with 7 more from this nodeset in the vector.
#> E1 E2 E3 E4 E5 E6 E7 E8 E9 E10 E11 E12 E13
#> 1 -1.32 -1.32 -1.32 -1.32 -1.32 -1.62 -1.62 -1.62 -1.62 -1.32 -1.32 -1.32 -1.32
#> # ... with 1 more from this nodeset in the vector.
```