MK_RMCentrality: Estimate radial and medial centrality measures.

View source: R/MK_RMCentrality.R

MK_RMCentralityR Documentation

Estimate radial and medial centrality measures.

Description

Use this function to calculate radial and medial centrality measure under one or several distance thresholds.

Usage

MK_RMCentrality(
  nodes,
  distance = list(type = "centroid"),
  distance_thresholds = NULL,
  binary = TRUE,
  probability = NULL,
  rasterparallel = FALSE,
  write = NULL,
  intern = TRUE
)

Arguments

nodes

Object containing nodes (e.g., habitat patches or fragments) information. It can be of the following classes:
- Data.frame with at least two columns: the first for node IDs and the second for attributes. If the 'restoration' argument is used, the data frame must include a third column for restoration values.
- Spatial data of type vector (class sf, SpatVector, SpatialPolygonsDataFrame). It must be in a projected coordinate system.
- Raster (class RasterLayer, SpatRaster). It must be in a projected coordinate system. The values must be integers representing the ID of each habitat patch or node, with non-habitat areas represented by NA values (see clump or patches).

distance

A matrix or list to establish the distance between each pair of nodes. Distance between nodes may be Euclidean distances (straight-line distance) or effective distances (cost distances) by considering the landscape resistance to the species movements. If it is a matrix, then the number of columns and rows must be equal to the number of nodes. This distance matrix could be generated by the distancefile function. If it is a list, then it must contain the distance parameters necessary to calculate the distance between nodes. For example, two of the most important parameters: “type” and “resistance”. For "type" choose one of the distances: "centroid" (faster), "edge", "least-cost" or "commute-time". If the type is equal to "least-cost" or "commute-time", then you must use the "resistance" argument. To see more arguments see the distancefile function.

distance_thresholds

A numeric indicating the dispersal distance or distances (meters) of the considered species. If NULL then distance is estimated as the median dispersal distance between nodes. Alternatively, the dispersal_distance function can be used to estimate the dispersal distance using the species home range.

binary

logical. Binary metrics, it only considers the distance thresholds to establish if a pair of nodes is (1) or not connected (0). Probability argument is not necessary.

probability

A numeric value indicating the probability that corresponds to the distance specified in the distance_threshold. For example, if the distance_threshold is a median dispersal distance, use a probability of 0.5 (50%). If the distance_threshold is a maximum dispersal distance, set a probability of 0.05 (5%) or 0.01 (1%). If probability = NULL, then a probability of 0.5 will be used.

rasterparallel

logical. If nodes is "raster" then you can use this argument to assign the metrics values to the nodes raster. It is useful when raster resolution is less than 100 m<sup>2</sup>.

write

character. Write output sf object. It is necessary to specify the "Folder direction" + "Initial prefix", for example, "C:/ejemplo".

intern

logical. Show the progress of the process, default = TRUE. Sometimes the advance process does not reach 100 percent when operations are carried out very quickly.

Details

This function implements Patch-Scale Connectivity or Centrality Measures. Radial measures: degree, strength (using probability argument, for weighted graphs), eigenvector centrality (eigen), and closeness centrality (close). Medial measures: betweenness centrality (BWC), node memberships (cluster), and modularity (modules, using probability argument). The function builds on functions out of Csardi’s ’igraph’ package.

References

Borgatti, S. P., & Everett, M. G. (2006). A Graph-theoretic perspective on centrality. Social Networks, 28(4), 466–484. https://doi.org/10.1016/j.socnet.2005.11.005
Hanski, I. and Ovaskainen, O. 2000. The metapopulation capacity of a fragmented landscape. Nature 404: 755–758.

Examples

## Not run: 
library(Makurhini)
library(sf)
data("habitat_nodes", package = "Makurhini")
nrow(habitat_nodes) # Number of patches
#Two distance threshold,
centrality_test <- MK_RMCentrality(nodes = habitat_nodes,
                                distance = list(type = "centroid"),
                                 distance_thresholds = c(10000, 100000),
                                 probability = 0.05,
                                 write = NULL)
centrality_test
plot(centrality_test$d10000["degree"], breaks = "jenks")
plot(centrality_test$d10000["BWC"], breaks = "jenks")
plot(centrality_test$d10000["cluster"], breaks = "jenks")
plot(centrality_test$d10000["modules"], breaks = "jenks")

## End(Not run)

connectscape/Makurhini documentation built on Jan. 12, 2025, 8:16 p.m.