get_metrics {priorCON} | R Documentation |
Detect graph communities for each biodiversity feature.
get_metrics(connect_mat, which_community = "s_core")
connect_mat |
a |
which_community |
|
Function get_metrics is used to calculate graph metrics values. The edge lists created from the previous step, or inserted directly from the user are used in this step to create graphs. The directed graphs are transformed to undirected. The function is based on the igraph package which is used to create clusters using Louvain and Walktrap and calculate the following metrics: Eigenvector Centrality, Betweenness Centrality and Degree. S-core is calculated using the package brainGraph.
connect_mat
is either the output of preprocess_graphs or
a custom edge list data.frame
object, with the following
columns:
feature
: feature name.
from.X
: longitude of the origin (source).
from.Y
: latitude of the origin (source).
to.X
: longitude of the destination (target).
to.Y
: latitude of the destination (target).
weight
: connection weight.
A list containing input for basic_scenario or connectivity_scenario.
Csárdi, Gábor, and Tamás Nepusz. 2006. The Igraph Software Package for Complex Network Research. InterJournal Complex Systems: 1695. https://igraph.org.
Csárdi, Gábor, Tamás Nepusz, Vincent Traag, Szabolcs Horvát, Fabio Zanini, Daniel Noom, and Kirill Müller. 2024. igraph: Network Analysis and Visualization in R. doi:10.5281/zenodo.7682609.
Watson, Christopher G. 2024. brainGraph: Graph Theory Analysis of Brain MRI Data. doi:10.32614/CRAN.package.brainGraph.
preprocess_graphs,
get_metrics
# Read connectivity files from folder and combine them
combined_edge_list <- preprocess_graphs(system.file("external",
package="priorCON"),
header = FALSE, sep =";")
# Set seed for reproducibility
set.seed(42)
# Detect graph communities using the s-core algorithm
pre_graphs <- get_metrics(combined_edge_list, which_community = "s_core")