average_interlayer_path_length: Calculate Average Interlayer Path Length (AIPL) for Plant...

View source: R/average_interlayer_path_length.R

average_interlayer_path_lengthR Documentation

Calculate Average Interlayer Path Length (AIPL) for Plant Trait Multilayer Networks

Description

This function calculates the Average Interlayer Path Length (AIPL) for a Plant Trait Multilayer Network (PTMN). AIPL describes the average path length between pairs of nodes from different network layers and reflects how efficiently information or resources can be transmitted across the network. Lower AIPL values indicate tighter, more efficient cross-layer connections, supporting the rapid transmission of environmental cues and resources among network layers and thereby enhancing the overall adaptability of the system.

Usage

average_interlayer_path_length(data)

Arguments

data

A data frame containing the PTMN edge list with required columns: node.from, layer.from, node.to, and layer.to. This data frame represents the network structure with both intralayer and interlayer connections.

Details

The AIPL is calculated using the formula from multilayer network theory:

AIPL = \frac{1}{\sum_{\alpha=1}^{M-1} \sum_{\beta=\alpha+1}^{M} \sum_{i \in \alpha}\sum_{j \in \beta} 1_{d_{ij} < \infty}} \sum_{\alpha=1}^{M-1} \sum_{\beta=\alpha+1}^{M} \sum_{i \in \alpha}\sum_{j \in \beta} d_{ij}

where d_{ij} is the shortest path length from node i (in layer \alpha) to node j (in layer \beta) and 1_{d_{ij} < \infty} is an indicator function of node reachability.

The function:

  1. Creates an undirected graph from the edge list

  2. Calculates shortest path distances between all node pairs

  3. Considers only node pairs from different layers (interlayer connections)

  4. Includes only finite path lengths (reachable pairs)

  5. Returns the mean of all valid interlayer path lengths

Value

A numeric value representing the average interlayer path length across all reachable node pairs between different layers. Returns NaN if no interlayer paths exist or all interlayer node pairs are unreachable.

See Also

PTMN for constructing plant trait multilayer networks

Examples

## Not run: 
data(forest_invader_tree)
data(forest_invader_traits)
traits <- forest_invader_traits[, 6:73]
layers <- list(
  shoot_dynamics = c("LeafDuration", "LeafFall50", "LeafRate_max",
                     "Chl_shade50", "LAgain", "FallDuration",
                     "LeafOut", "Chl_sun50", "EmergeDuration",
                     "LeafTurnover"),
  leaf_structure = c("PA_leaf", "Mass_leaf", "Lifespan_leaf",
                     "Thick_leaf", "SLA", "Lobe", "LDMC",
                     "Stomate_size", "Stomate_index"),
  leaf_metabolism = c("J_max", "Vc_max", "Asat_area", "CC_mass",
                      "LSP", "AQY", "CC_area", "Rd_area",
                      "Asat_mass", "WUE", "Rd_mass", "PNUE"),
  leaf_chemistry = c("N_area", "Chl_area", "DNA", "Phenolics",
                     "Cellulose", "N_mass", "N_litter", "Chl_ab",
                     "Chl_mass", "N_res", "C_litter", "C_area",
                     "C_mass", "Ash", "Lignin", "Solubles",
                     "Decomp_leaf", "Hemi"),
  root = c("NPP_root", "SS_root", "SRL", "RTD", "RDMC",
           "NSC_root", "Decomp_root", "Starch_root",
           "C_root", "N_root", "Lignin_root"),
  stem = c("Latewood_diam", "Metaxylem_diam", "Earlywood_diam",
           "NSC_stem", "Vessel_freq", "SS_stem", "Cond_stem",
           "Starch_stem")
)
graph <- PTMN(traits, layers_list = layers, method = "pearson")
average_interlayer_path_length(graph)

## End(Not run)


MultiTraits documentation built on March 22, 2026, 9:06 a.m.