DOI: 10.5061/dryad.0vt4b8hbj
title: Data from: 'ILSM': A package to analyze the interconnection structure of tripartite interaction networks

description: This dataset ‘Example_Interaction_Data’ comprises the empirical
 interaction data used in the ILSM R package for analyzing tripartite
 ecological network structure. The dataset contains quantitative
 interaction matrices from 49 distinct tripartite networks, systematically
 organized into two major ecological system types: 31
 Pollinator-Plant-Herbivore networks and 18 Plant-Herbivore-Parasitoid
 networks. This dataset ‘ILSM_Function‘ supports the ILSM R
 package for analyzing interconnection structures in tripartite ecological
 networks. The package provides computational functions to quantify 48
 interconnection motifs, species roles, and network-level patterns in
 tripartite interaction systems. Key functionalities include motif
 frequency analysis using matrix-based algorithms, connector species role
 assessment, interconnection centrality metrics, and null model generation
 for statistical testing. The tools handle both binary and weighted
 networks, supporting the analysis of ecological systems such as
 pollinator-plant-herbivore and plant-herbivore-parasitoid networks. All
 functions are implemented in R and designed for efficient processing of
 tripartite network data.
description: # Data from: 'ILSM': A package to analyze the interconnection
 structure of tripartite interaction networks In this example of the
 softnote, we collected two types of tripartite ecological network: 
 Plant-herbivore-parasitoid (PHP) and pollinator-plant-herbivore (PPH)
 networks are two kinds of commonly studied tripartite networks, with
 antagonistic-antagonistic interactions and mutualistic-antagonistic
 subnetworks, respectively. They also have different connector nodes,
 herbivores in PHP networks, and plants in PPH networks. ## Description of
 the data and file structure The "Example Interaction Data.Zip"
 contains the interaction network data for all examples, and
 "ILSM_Function.zip" contains the source function code for the R
 package.  ### Files and variables #### File: Example_Interaction_Data.zip
 **Description:** Data for example analyses: 31 Pollinator-Plant-Herbivore
 networks and 18 Plant-Herbivore-Parasitoid networks. ## Data Structure and
 Contents Each network is represented as a set of two bipartite interaction
 matrices that collectively form the complete tripartite ecological network
 without intra-guild. The dataset includes: There are two folders:
 'PHP_Plant-Herbivore-Parasitoid' and
 'PPH_Pollinator-Plant-Herbivore' Each folder is divided into two
 subfolders: \\'PHP_Plant-Herbivore-Parasitoid'\
 -&gt;'plant-herbivore' and 'heibivore-parasitoid' 
 \\'PPH_Pollinator-Plant-Herbivore'\
 -&gt;'pollinator-plant' and 'plant-heibivore' The
 names of subfolders correspond to interaction types of bipartite networks.
 Each subfloder contains binary matrices in CSV format. ## Variable
 Definitions Interaction matrices contain qualitative interaction relation
 (zero-one integers), with rows and columns representing species from
 adjacent trophic levels. It should be noted that not all species names are
 definite; some names use specific labels to indicate them. All matrices
 follow consistent formatting with proper dimension labels and missing
 value handling. #### File: ILSM_Function.zip **Description:** The source
 function code for the R package: *'icmotif_count.R'* The
 *icmotif_count* function calculates the frequency of each defined
 interconnection motif in a tripartite network. The function takes a graph
 or two matrices data inputs. The algorithm for counting interconnection
 motifs uses mathematical operations directly on the bi-adjacency matrix.
 We drive 48 expressions to enumerate the frequencies of 48 interconnection
 motifs. For weighted networks, the weight of a given motif is returned as
 the arithmetic mean of the weights of its links, following previous
 studies. *'icmotif_role.R'* The *icmotif_role* function
 calculates the frequency of each role within interconnection motifs for
 each connector species using a similar approach as above. **Functions for
 interconnection patterns** *'poc.R'* The *poc* function
 calculates the proportion of connector nodes in the shared set of nodes
 (POC). *'coid.R' and 'cois.R'* The *coid* function
 calculates the correlation of interaction degree (CoID) and the *cois*
 function calculates the correlation of interaction similarity (CoIS) for
 connector species. For CoID, two types of degrees (*d~P~* from P and
 *d~Q~* from Q) are calculated for each connector species, and the
 correlation of two degrees is calculated for binary networks; the degree
 is replaced with the Shannon diversity or sum of interaction strengths for
 weighted networks. For CoIS, the Jaccard index of interaction partners
 between pairs of connector species in each subnetwork is measured, and
 then the correlation between Jaccard coefficients in two subnetworks
 across all pairs of connector species; the generalized Jaccard index is
 used for weighted networks. *'pc.R'* The *pc* function
 calculates the participation coefficient. For each connector node *i,
 pc~i~* is calculated as two times the ratio between the lowest degree in
 both interaction subnetworks (*d~P~* and *d~Q~*) divided by the total
 degree of node *i* :                                                      
                       2*min(d~P~, d~Q~)/(d~P~ *+ d~Q~)* Hence, the
 participation coefficient for all connector nodes (PCc) is represented by
 the average value of all *pc~i~*. For weighted networks, the degree is
 replaced with the sum of link weights. *'hc.R'* The *hc*
 function counts the proportion of connector nodes in shared node hubs
 (HC). The connector node hubs are the top x% of shared nodes with the
 highest degree. The default x% is 20%. For weighted networks, the shared
 node hubs are determined with the highest sum of link weights instead.
 **Functions for interconnection centrality** *'node_icc.R'* The
 *node_icc* function provides three interconnection centrality metrics by
 modifying centrality algorithms from the R package “igraph” (version:
 2.1.1). For binary networks, the interconnection degree for each connector
 species is defined as the product of its degree values from two
 subnetworks. Interconnection betweenness is calculated as the number of
 shortest paths between a-nodes and c-nodes that pass through the connector
 species *sum(g~ivj~* */ g~ij~), where i ∈ a-nodes, j ∈ c-nodes* where
 *g~ij~* is the total number of shortest paths between node *i* from
 a-nodes and 𝑗 from c-nodes while *g~ivj~*~​ ~is the number of those
 shortest paths that pass through connector species 𝑣. Interconnection
 closeness is defined as the inverse of the sum of distances from the
 connector species to both a-nodes and c-nodes *1/sum(d~vi~), where i ∈
 a-nodes or c-nodes* where *d~vi~* is the distance between connector
 species *v* and species *i* from a-nodes and c-nodes. For weighted
 networks, interaction strengths are incorporated into the calculations of
 weighted degree, shortest paths, and distances. **Other functions**
 *'tri_null.R'* The *tri_null* function generates null models for
 a tripartite network. It provides two types of null models. The first type
 shuffles shared nodes following Sauve et al. (2016) without altering
 subnetwork links. The second type shuffles links in one or both
 subnetworks using algorithms from the R package “vegan” (version: 2.6-4),
 applied independently to one or both subnetworks. The null models can be
 used to test the statistical significance of observed patterns (see
 examples in the vignettes of this package).
 *'ig_icmotif_count.R' and 'ig_icmotif_role.R'*
 The *ig_icmotif_count* calculates the frequency of each interconnection
 motif and *ig_icmotif_role* returns the frequency of each role defined by
 motifs in an unweighted or weighted tripartite network with intra-guild
 interactions (see examples in the vignettes of this package). The
 algorithms for them are provided in the online documentation of this
 package. *'ig_ddom.R'* The *ig_ddom* calculates the degree of
 diagonal dominance for a tripartite network with intra-guild interactions
 (García-Callejas et al. 2023). *'ig_overlap_guild.R'* The
 *ig_overlap_guild* calculates species-level intra-guild and inter-guild
 interaction overlap for a tripartite network with intra-guild interactions
 (García-Callejas et al. 2023). *'adjust_net.R'* To optimize the
 tripartite network structure, this function refines the shared set by
 eliminating non-connector nodes. *‘Multi_motif.R’* The function represents
 the dictionary of interconnection motif forms without intra-guild
 interactions. *'trigraph_from_mat.R'* The function could
 transform two interaction matrices into an igraph-tripartite object.
 **Reference** Sauve, A. M. C., et al. 2016. How plants connect pollination
 and herbivory networks and their contribution to community stability. -
 Ecology 97: 908-917. García-Callejas, D., et al. 2023. Non-random
 interactions within and across guilds shape the potential to coexist in
 multi-trophic ecological communities. - Ecology Letters 26: 831-842. ##
 Access information Other publicly accessible locations of the data:
 [https://github.com/WeichengSun/ILSM](https://github.com/WeichengSun/ILSM)