View source: R/average_interlayer_path_length.R
| average_interlayer_path_length | R Documentation |
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.
average_interlayer_path_length(data)
data |
A data frame containing the PTMN edge list with required columns:
|
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:
Creates an undirected graph from the edge list
Calculates shortest path distances between all node pairs
Considers only node pairs from different layers (interlayer connections)
Includes only finite path lengths (reachable pairs)
Returns the mean of all valid interlayer path lengths
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.
PTMN for constructing plant trait multilayer networks
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.