# 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")
cost_raster <- get_cost_raster()
features_rasters <- get_features_raster()
# Solve a prioritizr prioritization problem, by incorporating graph connectivity
# of the features
connectivity_solution <- connectivity_scenario(
cost_raster = cost_raster,
features_rasters = features_rasters,
budget_perc = 0.1,
pre_graphs = pre_graphs
)
# Get outputs from connectivity_scenario function for feature "f1"
connectivity_outputs <- get_outputs(solution = connectivity_solution,
feature = "f1",
pre_graphs = pre_graphs)
# Plot tmap
connectivity_outputs$tmap
# Print summary of features and connections held percentages for connectivity
# scenario
print(connectivity_outputs$connectivity_table)
## feature relative_held connections(%)
## 1 f1 0.1637209 0.3339886
Run the code above in your browser using DataLab