Analyzes landscape connectivity using graph theory, resistance surfaces, and corridor identification for conservation planning. Use this skill when the user mentions habitat connectivity, wildlife corridors, Circuitscape, least-cost paths, resistance surfaces, IIC/dPC connectivity metrics, stepping stones, patch importance ranking, betweenness centrality, fragmentation analysis, landscape graphs, or pinchpoint identification.
Domain: Landscape connectivity · Graph theory · Circuitscape · Corridor · Resistance surface
Guides the agent through quantifying structural and functional landscape connectivity, identifying wildlife corridors, and calculating the contribution of individual habitat patches to overall network connectivity. Covers resistance surface construction, graph-based connectivity indices (IIC, PC, dPC), Circuitscape current mapping, and least-cost path analysis for corridor delineation.
Invoke this skill when:
trigger_keywords: habitat connectivity, wildlife corridor, dispersal, , , , , , , , , , , ,
gene flowlandscape graphresistance surfaceleast-cost pathcircuit theoryCircuitscapeIICPCdPCcorridor widthpatch importancelandscape permeability| Input | Format | Required |
|---|---|---|
| Habitat/land cover raster | GeoTIFF | Required |
| Study area polygon | SHP or GPKG | Required |
| Dispersal distance or dispersal kernel parameters | CSV or text | Required |
| Resistance value table (land cover class → resistance) | CSV | Recommended |
| Existing protected areas or focal nodes | SHP or GPKG | Optional |
| Habitat class codes | Integer codes or CSV lookup | Optional |
| Output | Description |
|---|---|
patch_metrics.csv | Area, perimeter, IIC, PC, dIIC, dPC per patch |
connectivity_summary.csv | Global IIC, PC, and top-10 patches by dPC |
top_patches_map.tif | Raster with dPC value per patch |
connectivity_graph.png | Habitat patch network diagram |
resistance_surface.tif | Resistance surface for Circuitscape input |
patch_betweenness.csv | Betweenness centrality per patch (graph metric) |
least_cost_paths.gpkg | Least-cost path lines between patch pairs |
Prepare habitat patches
Load land cover raster and mask to study area using geoprocessing-for-ecology.
Reclassify to binary habitat/non-habitat. Extract discrete habitat patches
with terra::patches() or landscapemetrics::get_patches().
Filter patches below minimum area threshold (document threshold in decision_log.md).
Build resistance surface (invoke resistance_surface.R)
Reclassify land cover using the resistance table.
Apply optional focal smoothing to avoid hard edges.
Validate: all land cover classes must have an assigned resistance value.
Output: resistance_surface.tif.
Calculate distance matrix between patches Compute pairwise Euclidean or least-cost distances between patch centroids. If dispersal distance threshold is unknown, use 3 values for sensitivity analysis: conservative (25th percentile), medium (median), optimistic (75th percentile).
Compute connectivity indices (invoke connectivity_metrics.R)
Calculate IIC and PC for each dispersal distance scenario.
Compute dIIC and dPC (patch removal importance) for all patches.
Rank patches by dPC to identify conservation priorities.
Run Circuitscape for corridor mapping (optional, requires Circuitscape installed)
Export focal nodes (top-N patches by dPC) and resistance surface.
Run in all-to-one mode to produce cumulative current density map.
Interpret high-current corridors as priority dispersal pathways.
Delineate least-cost paths (invoke connectivity_analysis.py)
Use scikit-image.graph.route_through_array() for least-cost paths.
Output vector lines between top-priority patch pairs.
Validate outputs and record decisions
Check dPC values sum approximately to the global PC.
Record dispersal distance scenario, resistance table source, and minimum patch area
in decision_log.md.
| Condition | Diagnosis | Recommended Action |
|---|---|---|
| Dispersal distance unknown | Sensitivity of results to this parameter is high | Run analysis at 3 distances (conservative, medium, optimistic); report range of outcomes |
| Landscape < 10 patches | Graph metrics statistically unstable | Use fragmentation metrics from ecological-impact-assessment skill instead |
| IIC or PC < 0.01 | Extremely low connectivity | Prioritise restoration before corridor analysis; identify bottleneck patches |
| dPC > 0.8 for a patch already deforested | High-priority patch lost | Escalate to restoration planning; include in gap analysis |
| All patches isolated (no edges at chosen distance) | Threshold too restrictive | Increase dispersal distance or use resistance-based (cost) distance threshold |
Record the following in decision_log.md after running this skill:
R
suppressPackageStartupMessages(library(terra)) # raster operations
suppressPackageStartupMessages(library(sf)) # vector operations
suppressPackageStartupMessages(library(landscapemetrics)) # patch extraction and metrics
suppressPackageStartupMessages(library(igraph)) # graph theory (IIC, PC, betweenness)
suppressPackageStartupMessages(library(dplyr)) # data manipulation
suppressPackageStartupMessages(library(ggplot2)) # plotting
Python
import networkx as nx # graph metrics (betweenness centrality)
from skimage.graph import route_through_array # least-cost path
import geopandas as gpd # vector operations
import rasterio # raster reading
import numpy as np # numerical operations
from pathlib import Path # file system
CLI
# Circuitscape (optional, must be installed)
circuitscape_4_0 <config_file.ini>
# or Julia-based CS4
julia -e "using Circuitscape; compute(<config_file.ini>)"
skills/landscape-connectivity/resources/graph-theory-for-ecology.md — IIC, PC, dPC formulas, interpretation, and dispersal threshold definitionskills/landscape-connectivity/resources/resistance-surface-guide.md — Resistance value assignment by taxon, calibration methods, and Circuitscape exportskills/landscape-connectivity/resources/circuitscape-parameter-guide.md — Circuitscape modes, focal nodes, solver selection, and output interpretationA). Always report the landscape extent used in calculation to enable comparison across studies.