Unlimited learning, half price | 50% off

Last chance! 50% off unlimited learning

Sale ends in


graph4lg (version 1.8.0)

compute_node_metric: Compute graph-theoretic metrics from a graph at the node level

Description

The function computes graph-theoretic metric values at the node level.

Usage

compute_node_metric(
  graph,
  metrics = c("deg", "close", "btw", "str", "siw", "miw"),
  weight = TRUE
)

Value

A data.frame with the node names and the metrics computed.

Arguments

graph

An object of class igraph. Its nodes must have names.

metrics

Character vector specifying the graph-theoretic metrics computed at the node-level in the graphs Graph-theoretic metrics can be:

  • Degree (metrics = c("deg", ...))

  • Closeness centrality index (metrics = c("close",...))

  • Betweenness centrality index (metrics = c("btw",...))

  • Strength (sum of the weights of the links connected to a node) (metrics = c("str",...))

  • Sum of the inverse weights of the links connected to a node (metrics = c("siw", ...), default)

  • Mean of the inverse weights of the links connected to a node (metrics = c("miw", ...))

By default, the vector metrics includes all these metrics.

weight

Logical which indicates whether the links are weighted during the calculation of the centrality indices betweenness and closeness. (default: weight = TRUE). Link weights are interpreted as distances when computing the shortest paths. They should then be inversely proportional to the strength of the relationship between nodes (e.g. to fluxes).

Author

P. Savary

Examples

Run this code
data(data_ex_genind)
mat_gen <- mat_gen_dist(x = data_ex_genind, dist = "DPS")
graph <- gen_graph_thr(mat_w = mat_gen, mat_thr = mat_gen,
                            thr = 0.8)
res_met <- compute_node_metric(graph)

Run the code above in your browser using DataLab