Use this function to calculate radial and medial centrality measure under one or several distance thresholds.
MK_RMCentrality(
nodes,
distance = list(type = "centroid"),
distance_thresholds = NULL,
binary = TRUE,
probability = NULL,
rasterparallel = FALSE,
write = NULL,
intern = TRUE
)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).
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 of parameters, 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. For example: distance(type = "least-cost", resistance = raster_resistance).
To see more arguments see the distancefile function.
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.
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.
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.
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>.
character. Write output sf object. It is necessary to specify the "Folder direction"
+ "Initial prefix", for example, "C:/ejemplo".
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.
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 via short random walks ("memb.rw") and Louvain algorithm ("memb.louvain"). The function builds on functions out of Csardi’s ’igraph’ package.
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.
if (FALSE) { # \dontrun{
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.5,
write = NULL)
centrality_test
plot(centrality_test$d10000["strength"], breaks = "jenks")
plot(centrality_test$d10000["BWC"], breaks = "jenks")
plot(centrality_test$d10000["memb.rw"], breaks = "jenks")
plot(centrality_test$d10000["memb.louvain"], breaks = "jenks")
} # }