centrality {wdnet}R Documentation

Centrality measures

Description

Computes the centrality measures of the nodes in a weighted and directed network.

Usage

centrality(
  netwk,
  adj,
  edgelist,
  edgeweight,
  directed = TRUE,
  measure = c("degree", "closeness", "wpr"),
  degree.control = list(alpha = 1, mode = "out"),
  closeness.control = list(alpha = 1, mode = "out", method = "harmonic", distance =
    FALSE),
  wpr.control = list(gamma = 0.85, theta = 1, prior.info = NULL)
)

Arguments

netwk

A wdnet object that represents the network. If NULL, the function will compute the coefficient using either edgelist and edgeweight, or adj.

adj

An adjacency matrix of a weighted and directed network.

edgelist

A two-column matrix representing edges of a directed network.

edgeweight

A vector representing the weight of edges.

directed

Logical. Indicates whether the edges in edgelist or adj are directed.

measure

Which measure to use: "degree" (degree-based centrality), "closeness" (closeness centrality), or "wpr" (weighted PageRank centrality)?

degree.control

A list of parameters passed to the degree centrality measure:

  • 'alpha' A tuning parameter. The value of alpha must be nonnegative. By convention, alpha takes a value from 0 to 1 (default).

  • 'mode' Which mode to compute: "out" (default) or "in"? For undirected networks, this setting is irrelevant.

closeness.control

A list of parameters passed to the closeness centrality measure:

  • 'alpha' A tuning parameter. The value of alpha must be nonnegative. By convention, alpha takes a value from 0 to 1 (default).

  • 'mode' Which mode to compute: "out" (default) or "in"? For undirected networks, this setting is irrelevant.

  • 'method' Which method to use: "harmonic" (default) or "standard"?

  • 'distance' Whether to consider the entries in the adjacency matrix as distances or strong connections. The default setting is FALSE.

wpr.control

A list of parameters passed to the weighted PageRank centrality measure:

  • 'gamma' The damping factor; it takes 0.85 (default) if not given.

  • 'theta' A tuning parameter leveraging node degree and strength; theta = 0 does not consider edge weight; theta = 1 (default) fully considers edge weight.

  • 'prior.info' Vertex-specific prior information for restarting when arriving at a sink. When it is not given (NULL), a random restart is implemented.

Value

A list of node names and associated centrality measures

Note

The degree-based centrality measure is an extension of function strength in package igraph and an alternative of function degree_w in package tnet.

The closeness centrality measure is an extension of function closeness in package igraph and function closeness_w in package tnet. The method of computing distances between vertices is the Dijkstra's algorithm.

The weighted PageRank centrality measure is an extension of function page_rank in package igraph.

References

Examples

## Generate a network according to the Erd\"{o}s-Renyi model of order 20
## and parameter p = 0.3
edge_ER <- rbinom(400, 1, 0.3)
weight_ER <- sapply(edge_ER, function(x) x * sample(3, 1))
adj_ER <- matrix(weight_ER, 20, 20)
mydegree <- centrality(
  adj = adj_ER,
  measure = "degree", degree.control =
    list(alpha = 0.8, mode = "in")
)
myclose <- centrality(
  adj = adj_ER,
  measure = "closeness", closeness.control =
    list(alpha = 0.8, mode = "out", method = "harmonic", distance = FALSE)
)
mywpr <- centrality(
  adj = adj_ER,
  measure = "wpr", wpr.control =
    list(gamma = 0.85, theta = 0.75)
)


[Package wdnet version 1.2.3 Index]