README.md

gDefrag

gDefrag is an R package designed to assist in mitigating landscape fragmentation caused by linear infrastructures such as roads, railways, and pipelines. By representing landscapes as graphs, gDefrag enables users to identify and prioritise critical connections to enhance habitat connectivity.

Overview

Landscape fragmentation poses significant challenges to biodiversity conservation. gDefrag offers a graph-based approach to model and analyse habitat connectivity, allowing for the identification of key areas where mitigation efforts can be most effective.

The package is based on the work presented in:

Mestre, F., Ascensão, F., & Barbosa, A.M. (2019). gDefrag: A graph-based tool to help defragmenting landscapes divided by linear infrastructures. Ecological Modelling, 392, 1–5.\ https://doi.org/10.1016/j.ecolmodel.2018.10.012

Features

Thanks to Thais Ranzi (UFRGS, Brazil) for spotting a few bugs in the code.

Installation

To install the latest version from GitHub:

# Install devtools if not already installed 
install.packages("devtools")

# Install gDefrag from GitHub
devtools::install_github("FMestre1/gDefrag")

Example


#Load gDefrag
library(gDefrag)

# Create nodes
out1 <- node.creation(land_polyg = road_P, 
                      value_col = "frst_sm",
                      scale_nodes = 10, 
                      cex_labels = 1 
                      )

# Create edges
out2 <- edge.creation(nodes = out1, 
                      land_polyg = road_P,
                      min_length = 0, 
                      min_pol_area = 0
                      )

# Prioritize using "value"                      
out3 <- prioritize(nodes = out1, 
                   edges = out2, 
                   method = "value"
                   )

# Prioritize using "IIC"                      
 out4 <- prioritize(nodes = out1, 
                   edges = out2, 
                   method = "IIC"
                   )




FMestre1/gDefrag documentation built on June 11, 2025, 1:32 a.m.