graph4lg - Tutorial

Paul SAVARY

2019-07-19

Introduction

The creation of the graph4lg package on R should make easier the construction and analysis of genetic and landscape graphs in landscape genetics studies (hence the name graph4lg). The package allows to weight the links and to prune the graphs by several ways. To our knowledge, it is the first software which enables to create genetic graphs with such a large variety of parameters. Besides, it allows to carry out preliminary analyses of the spatial pattern of genetic differentiation in order to choose the best genetic distance and pruning method in every context. Lastly, it makes possible the comparison of two spatial graphs sharing the same nodes.

In the following sections, we describe the functions of the package following their separation into three parts. We illustrate them with results’ examples and report the command lines to copy in order to reproduce them.

Loading of the data used to create the tutorial

The package includes genetic and spatial data allowing users to discover its different functionalities. We included two datasets. The first is from French Guadeloupe and consists of 432 Plumbeous Warblers (Setophaga plumbea) genotyped at 12 microsatellite loci (169 different alleles in total) from 20 populations whose spatial coordinates are available. These data were collected and analysed by Khimoun et al. (2017). They are also freely available on the website datadryad.org. They were included in the package in different formats: data.frame format with columns of locus class from the package gstud, genind class from adegenet, loci class for pegas, text files (.txt) for GENEPOP or STRUCTURE.

The second data set was created during simulations done with CDPOP (Landguth and Cushman 2010) on a simulated landscape. It consists of 1500 individuals from 50 populations genotyped at 20 microsatellite loci. Individuals dispersed less when the cost-distance between populations was large. These data were included in format genind and as a text file compatible with GENEPOP software. A landscape graph was created with GRAPHAB (Foltête, Clauzel, and Vuidel 2012) whose nodes were the 50 simulated populations and the links were weighted by cost-distance values between populations. The project created with GRAPHAB was included into the package such that the landscape graphs and the cost-distance matrix can be easily imported into the R environment.

Input data processing

The first type of functions from this package allows to process spatial and genetic data used as input data in subsequent analyses performed with other functions. These functions convert genetic data, compute genetic or geographical distances, import landscape graphs and convert cost-distance values into Euclidean geographical distances.

Genetic data conversion

In order to make the package user-friendly and compatible with genetic data commonly used in landscape genetics, the functions gstud_to_genind, loci_to_genind, structure_to_genind and genepop_to_genind allow to convert genetic data from formats used respectively in the GENETIC STUDIO (Dyer 2009) and pegas (Paradis 2010) packages on R and in STRUCTURE (Pritchard, Stephens, and Donnelly 2000) and GENEPOP (Raymond 1995) software into R objects with the class attribute genind from ADEGENET package (Jombart 2008). The format genind allows to use time-efficient functions from ADEGENET (coded in C). This package was developed and is regularly maintained by Thibaut Jombart (his website). The function genind_to_genepop enables to convert genind object into text files in format genepop in order to perform easily analyses with this commonly used R package and executable software.

Genetic data in formats used by software commonly used in population genetics can be converted into genind objects in R. This class of object was created for the package adegenet (Jombart 2008).

GENEPOP to genind

The GENEPOP software (Raymond 1995) developed by M. Raymond and F. Rousset (Montpellier) can be used as an executable file, with or without graphical user interface, or as a R package. It is frequently used to compute FST values and to test for Hardy-Weinberg equilibrium, linkage disequilibrium or genetic differentiation.

When performing simulations with CDPOP, individuals’ genotypes can be saved as GENEPOP files at the end of the simulation.

The function genepop_to_genind loads a GENEPOP file (.txt extension) and converts it into a genind object. To use it, the path to the file, the total number and names of the loci and the populations’ names must be indicated.

We get a genind object. It contains the genotypes of the 1500 individuals from the 50 populations created during the simulation.

genind to GENEPOP

Similarly, the function genind_to_genepop allows to perform the reverse conversion, i.e. to convert a genind object into a GENEPOP file. This file is created and saved in the working directory defined earlier.

This function allows for example to create a GENEPOP file to test for between populations genetic differentiation or to compute fixation indices with GENEPOP software.

STRUCTURE to genind

STRUCTURE software (Pritchard, Stephens, and Donnelly 2000) is frequently used in population genetics and landscape genetics. It enables to create populations’ clusters via a Bayesian approach aiming at minimizing the deviation from Hardy-Weinberg equilibrium when gathering populations with one another. The input files have a particular structure. The function structure_to_genind allows to convert this type of file into a genind object.

To use the function, we need to indicate the path to the file, the names of the loci, the individuals’ ID and the populations’ names in the same order as in the original file.

gstud to genind

Packages gstudio and popgraph developed by R. Dyer (Dyer 2009) use as input data R data.frames with columns of class locus. These data.frame objects constitute gstud objects. Given these packages are often used to create genetic graphs, we created a function to convert them into the genind format.

A gstud object generally has the following structure (Plumbeous Warbler data from Guadeloupe as an example):

To convert it with the function gstud_to_genind, we indicate the name of the data.frame and of the columns with populations’ names and individuals’ names:

Genetic and geographical distances calculation

Genetic distances

From a genind object, the function mat_gen_dist calculates several types of between populations genetic distances:

  • FST (Weir and Cockerham 1984) or linearised FST (Rousset 1997) (options ‘dist=FST’ and ‘dist=FST_lin’).

  • G’ST (Hedrick 2005) (option ‘dist=GST’).

  • DJost (Jost 2008) (option ‘dist=D’).

  • DPS (1 - proportion of shared alleles) (Bowcock et al. 1994, @murphy_graph_2015) (option ‘dist=DPS’).

  • Euclidean genetic distance (Excoffier, Smouse, and Quattro 1992) (option ‘dist=basic’).

  • Euclidean genetic distance with a weighting depending on allelic frequencies giving more weight to rare alleles (Fortuna et al. 2009) (option ‘dist=weight’).

  • Euclidean genetic distance computed after a PCA of the matrix of allelic frequencies by population. The axes considered to compute the Euclidean distance are the non-collinear principal components (total number of alleles - number of loci) (Paschou et al. 2014, @shirk2017comparison) (option ‘dist=PCA’).

  • Euclidean genetic distance computed in the same way as with the function popgraph from popgraph package, i.e. after a PCA and two SVD, among other computation steps (option ‘dist=PG’). This distance is different from the conditional genetic distance (cGD) computed from a population graph by summing genetic distances along shortest paths.

To do these calculations with the function mat_gen_dist, you just have to indicate the name of the genind object which includes the genetic data of the individuals as well as the populations to which each of them belongs. The other argument of the function is the type of genetic distance to compute. Here are two examples:

Import of landscape graphs created with GRAPHAB

The function graphab_to_igraph allows to import landscape graphs created with software into the R environment. It takes the path to the directory of a project created with as a first argument. Then, the names of the shapefile layers corresponding to the nodes and links (the least-cost paths or a set of graph links) of the graphs must be indicated (for the nodes, by default, the shapefile layers “patches.shp” is imported). The links of the imported graph are weighted by cost-distance values or by geographical distance values depending on the weight option. The graph can be plotted on a geographical map. Besides, an object of type data.frame with the spatial coordinates of the nodes’ centroids can be created.

As an example, the following command allows to import the project created to parameterize the gene-flow simulation on performed to create data_simul_genind:

The land_graph object is a list composed of an object of class igraph corresponding to the landscape graph, and of a table of class data.frame with the coordinates of the patches’ centroids.

We create a matrix with the cost-distances between populations from the links of the landscape graph imported, which is a complete graph. You have to pay attention to the order of the populations’ names in the distance matrices, even if error messages will appear when using the functions of this package if you use two matrices in which rows’ and columns’ names do not match. The function reorder_mat reorders the rows and columns of a symmetric matrix according to a specified order. To use it, you just need to create a character vector with the rows and columns names from the symmetric matrix in the order you want them to be ordered in the new matrix.

Geographical distances

You can also calculate Euclidean geographical distances between populations with the function mat_geo_dist. It takes as an argument a data.frame with 3 columns:

  • ID : populations’ ID (or simple points’ ID when using this function in another context)

  • x : populations’ or points’ longitude

  • y : populations’ or points’ latitude

Geographical coordinates must be expressed in a projected coordinates system (metric) because Pythagoras’s theorem is used to compute the distances (a warning message is displayed in every case).

Example :

Cost-distances are expressed in cost units arbitrarily defined based on the cost values assigned to every land cover type when creating resistance surfaces. However, species dispersal distances are usually known as distances expressed in metric units. When we know that the probability that a species covers 10 km is 5 %, we can ask what is the equivalent of this distance in cost distance units according to the scenario of cost values assumed. It allows to prune a landscape graph with a given distance threshold e.g. or provides an order of magnitude of the cost-distance values.

To that purpose, you can perform a regression of the between populations cost-distance values against the corresponding geographical distances. It estimates the relationship between both types of distance. Then, the resulting parameters estimates enable to convert a geographical distance into its cost-distance equivalent according to the cost scenario.

The function convert_cd performs the linear regression or log-log linear regression between the geographical distance matrix and the cost-distance matrix, in the same way as Tournant et al. (2013) and as performed by GRAPHAB software.

Below, we estimate the relationship between geographical distance and cost-distance between the populations used to perform the gene-flow simulation. We convert 10 km into cost-distance units. The function also plots the relationship between these distances.

In this case, we can see that 10 km are equivalent to 1606 cost-distance units. The log-log linear model estimates the relationship between geographical distance (GD) and cost-distance (CD) such that: \(log(CD)=-2.2512+1.0458 \times log(GD)\). The determination coefficient \(R^2\) associated to this linear model is 0.69. The black dot represented on the figure refers to the 10 km value on the regression line characterizing the relationship between cost-distance and geographical distance.

Graphs’ construction

Some functions from graph4lg package construct graphs from either genind objects or genetic or landscape distance matrices. To choose a genetic distance and a pruning method for the genetic graphs’ construction, we developed functions to perform preliminary analyses of the spatial pattern of genetic differentiation. Indeed, a genetic graph can be created in order to i) identify the direct dispersal paths between populations or to ii) select the set of population pairs to consider to infer landscape effects on dispersal. According to the use of a genetic graph and to the spatial pattern of genetic differentiation (type-I or type-IV pattern of IBD (Hutchison and Templeton 1999, @van2015isolation)), the choice of a genetic distance and of a pruning method will not be the same.

Van Strien, Holderegger, and Van Heck (2015) computed the so-called distance of maximum correlation (DMC) as the distance between populations below which population pairs should be considered in order to maximize the correlation between landscape distance (geographical distance in their case, but applies similarly to cost-distance) and genetic distance. This distance threshold is computed by increasing iteratively the maximum distance between populations above which population pairs are not taken into account to compute the correlation. Thus, an increasing number of population pairs is considered in the inference. When the correlation coefficient between landscape distance and genetic distance reaches a maximum, the distance threshold considered is the DMC. When the DMC is equal to the maximum distance between populations, it means that an equilibrium established between gene flow and genetic drift at the scale of the study area. Conversely, when the DMC is lower than this maximum distance, it means that there is a “plateau” in the relationship between landscape distance and genetic distance because migration-drift equilibrium has not been reached yet at the scale considered. It can be due to recent modifications of the landscape which consistently reduced the connectivity in a previously connected context. In this case, graph pruning is needed to well infer landscape effect on dispersal. Similarly, genetic distances that do not assume this equilibrium should be used.

The function dist_max_corr calculates the DMC from two distance matrices. You need to specify the interval between two distance thresholds iteratively considered to select population pairs and compute the correlation coefficient. The function scatter_dist, on the other hand, allows to visualize the relationship between two distance matrices by making a scatter plot. The shape of this relationship can be compared to the four different types of IBD patterns described by Hutchison and Templeton (1999) in order to characterize the spatial pattern of genetic differentiation.

Here are the command lines to execute to use these two functions:

dmc <- dist_max_corr(mat_gd = mat_dps, mat_ld = mat_ld, 
              interv = 500, pts_col = "black")

The dmc object is a list with 1) the DMC value, 2) a vector containing all the computed correlation coefficients, 3) a vector with all the distance thresholds tested and 4) a graphic object created with the ggplot2 package.

# DMC value
dmc[[1]]
#> [1] 4500
# Correlation coefficients
dmc[[2]]
#>  [1]        NA 0.2986565 0.3154498 0.5188747 0.7059633 0.7559539 0.7850267
#>  [8] 0.7947691 0.8038470 0.7853646 0.7760106 0.7641339 0.7530264 0.7462445
#> [15] 0.7386713 0.7333936 0.7305631 0.7226695 0.7137972 0.7110962 0.7041702
# Threshold distances tested
dmc[[3]]
#>  [1]   500.00  1000.00  1500.00  2000.00  2500.00  3000.00  3500.00
#>  [8]  4000.00  4500.00  5000.00  5500.00  6000.00  6500.00  7000.00
#> [15]  7500.00  8000.00  8500.00  9000.00  9500.00 10000.00 10230.05

The figure below represents the evolution of the correlation coefficient values when distance thresholds increase.

dmc[[4]]

The scatter plot is displayed with the function scatter_dist.

scatter_dist(mat_gd = mat_dps, mat_ld = mat_ld, 
             pts_col = "black")
#> 1225 out of 1225 values were used.

In this particular case, we notice a type-IV pattern of isolation by distance with a “plateau” in the relationship between cost-distance and genetic-distance (DPS). Graph pruning will be needed to select the population pairs to include in the inference of landscape effects on dispersal.

In the following section, we present the different pruning methods available.

Pruning based on distance thresholds

To prune a graph whose links are weighted by distances, you can remove all the links associated to geographical or genetic distances larger (or lower) than a specific threshold distance. This distance can for example be equal to the maximum dispersal distance of an individual of the study species at the scale of its lifespan so that the resulting graph represents the direct dispersal paths of the species. It can also be equal to the DMC if the objective is to infer landscape effects on dispersal.

The function gen_graph_thr takes as arguments a distance matrix used to weight the links of the resulting graph (mat_w) and a distance matrix on which the “thresholding” is based (mat_thr). The selected links are selected according to the values of this latter matrix. The argument thr is the numerical value of the threshold distance. If mat_thr is not specified, mat_w is used by default for the thresholding. Lastly, you have to specify if the links to remove take larger or lower values than the threshold value.

The function returns a graph in the form of an igraph object, which is consequently compatible with all functions from igraph package (Csardi and Nepusz 2006), one of the most used R package to create and analyse graphs (together with sna and networks). In the latter example, the graph has 50 nodes and 162 links when we prune it using a 12-km distance threshold. Its links are weighted with the values of the mat_dps matrix.

Pruning based on topological constraints

A graph can be pruned according to a topological criterion. The function gen_graph_topo can use 4 different criteria. As with the previous function, topological criteria are applied by considering the distance values of the mat_topo matrix, but the links are weighted with the values of the mat_w matrix (except when mat_topo is not specified, cf. previous section).

Gabriel graph: in the created graph, two nodes are connected by a link if, when we draw a circle whose center is set at the middle of the segment linking them and whose radius is equal to half the length of this segment, there is no other node inside the circle. In mathematical terms, it means that there is a segment between \(x\) and \(y\) if and only if for every other point \(z\), we have: \(d_{xy}\leq \sqrt{d_{xz}^{2}+d_{yz}^{2}}\). We can compute such a graph from geographical distances (Gabriel and Sokal 1969) (graph_gab_geo below) but also, less commonly, from genetic distances (Naujokaitis-Lewis et al. 2013) (graph_gab_gen below). In the latter case, it is to some extent as if Pythagoras’s theorem was applied to genetic distances, which can seem a bit strange even if this method has already been used by Naujokaitis-Lewis et al. (2013).

Minimum Spanning Tree (MST): it creates a minimum spanning tree, i.e a graph in which every node is connected by a link to at least another node and whose total links’ weight is minimum. By definition, its number of links is equal to the number of nodes - 1.

“Percolation” graph: the graph is created by removing iteratively some links, beginning with those with the highest weights until the graph breaks into more than one component. We conserve the link whose removal entails the creation of another component to obtain a connected graph. This method is also called the edge-thinning method (Urban et al. 2009). Such a method is linked to percolation theory (Rozenfeld et al. 2008). The function gen_graph_topo indicates the number of conserved links and the weight of the link whose removal disconnects the graph (maximum link weight of the created graph).

Complete graph: the function allows to create a complete graph from a distance matrix. In that case, there is no pruning and, by definition, all population pairs are connected.

Pruning based on the conditional independence principle

The last pruning method implemented by the graph4lg package is based upon the conditional independence principle. The function gen_graph_indep is largely inspired by the function popgraph created by R. Dyer (Dyer and Nason 2004), but does not need the package popgraph to function. Besides, as some calculations are performed with functions from the adegenet package (coded in C), it is faster than the original popgraph function. It is also more flexible than popgraph function given you can vary i) the way we compute genetic distances used to weight the links and to compute the covariance between populations, ii) the formula used to compute the covariance from squared distances or alternatively simple distances, iii) the statistical tolerance threshold, iv) the p-values adjustment and v) the returned objects created by the function. Without entering further into the details, here is an implementation example.

Graphs’ processing and analysis

Once the graphs have been created, you can perform calculation from them, visualize and export them.

Graphical application

Representation of the graph on a map

The function plot_graph_lg integrates functions from igraph and ggplot2 to represent graphs on a map. Most frequently, graphs are spatial and a table with populations’ coordinates must be given as an argument. It must have exactly the same structure as the table given as an argument to mat_geo_dist (3 columns : ID, x, y). The visual representation can make visible the links’ weights by plotting the links with a width proportional to the weight (width = "w") or the inverse weight (width = "inv") of the links.

For example, with the graph graph_mst :

If the populations’ spatial coordinates are not available, you can still display the graph on a two-dimensional plane. In that case, the nodes’ positions are computed with Fruchterman and Reingold (1991) algorithm to optimize the representation. With the graph graph_mst, we obtain:

Representation of the graph’s modules on a map

You can also plot the results of a graph’s partition carried out by computing a modularity index with the function plot_graph_modul. This function is similar to plot_graph_lg. The main difference is that the graph’s nodes from the same modules are displayed in the same color.

Several algorithms can be used: fast greedy (Clauset, Newman, and Moore 2004), louvain (Blondel et al. 2008), optimal (Brandes et al. 2008) and walktrap (Pons and Latapy 2006). The number of created modules in each graph is adjustable but can be fixed depending on the optimal values of the modularity indices. Besides, the modularity calculation can take into account the links’ weights or not. When taken into account, the weight given to a link in the calculation will be i) proportional to or ii) inversely proportional to the genetic or landscape distance to which it is associated.

In the following example, the graph is partitioned into 6 modules with the fast_greedy algorithm (default option).

Spatial layers export

Even if the function plot_graph_lg enables to visualize a spatial graph on a geographical plane, it is often useful to confront the populations’ and links’ locations to other types of spatial data. To that purpose, you can export the graph into shapefile layers in order to open them in a GIS. The graphs’ nodes must have spatial coordinates. When exporting, you can choose to export only the nodes’ shapefile layer, the links’ shapefile layer or both. You can also compute metrics associated to the nodes (degree, betweenness, sum of inverse links weights). These metrics will be included in the attribute table of the exported nodes’ shapefile layer. For the links, the attribute table contains the weights associated to every link. The function graph_to_shp takes also as an argument the coordinates reference system (CRS) in which the points’ coordinates from the table are expressed. It will be the CRS of the created shapefile layers. The last argument is the suffix given to the shapefile layers’ names beginning with “node” or “link”.

Shapefile layers are created in the working directory and can be imported into a GIS.

Metrics calculation

You can also compute metrics from graphs with functions from igraph package on R. For example, to compute the nodes’ degree:

You can also perform modularity analyses:

Metrics’ values can be associated to the nodes to which they correspond. To that purpose, 1) you can create a data.frame to store the values. It must have a column with the nodes’ names in the same form as the nodes’ names of the igraph object from which you compute the metric.

Then, you add the metrics’ values to the igraph object as nodes’ attributes.

It is another and more flexible way to export metrics’ values in the attribute table of the shapefile layers created with the function graph_to_shp.

You can also 2) associate metrics’ values computed with GRAPHAB software to the nodes of the igraph object. In this case, you have to specify the path to a shapefile layer created with GRAPHAB whose attribute table contains a field with the graph’s nodes names.

Graphs’ comparison

In landscape genetics, the analysis of the link between landscape and genetic data can be performed at several scales. Indeed, node-, link-, neighbourhood- and boundary-based analyses are distinguished (Wagner and Fortin 2013). Similarly, you can compare landscape and genetic graphs at several scales, in particular when they share the same nodes. Two graphs are similar if the correlation coefficient (non parametric rank correlation ) between the metric values calculated for the same nodes or between the distance values associated to the same links is high. Similarly, they are similar if the conserved links of one graph are the same ones as those conserved in the other. Finally, two graphs have similar topological and connectivity properties if their modules match, i.e. if two nodes classified together in the same module when the partition in modules is computed from one graph are also classified together in the same module when the partition is computed from the other graph.

We included two functions allowing such comparisons. The function graph_topo_compar compares the topologies of two graphs sharing the same nodes. To do that, it creates a contingency table whose modalities are “Presence of a link” and “Absence of a link”. We consider the topology of one graph to represent the “reality” of the dispersal flows that the other one is supposed to reproduce. In the (double entry) contingency table, when there is a 10 in the cell “Presence of a link” \(\times\) “Presence of a link”, it means that 10 links between the same population pairs are present in the two graphs compared. The 10 value corresponds to the number of true positives (TP). The three other values of the table are the number of false positives (FP), true negatives (TN) and false negatives (FN). From this table, you can compute several metrics often used to evaluate the performance of classification methods: the Matthews’ correlation coefficient (Matthews 1975), the Kappa index, the False Discovery Rate, the Accuracy, the Sensitivity, the Specificity and the Precision.

For example, you can create a landscape graph from a cost-distance matrix using a threshold of 2000 cost-distance units and then compare the topology of this graph to that of the Gabriel graph created from the same nodes by computing the Matthews’ correlation coefficient.


land_graph2 <- gen_graph_thr(mat_w = mat_ld, mat_thr = mat_ld,
                             thr = 2000, mode = "larger")

graph_topo_compar(obs_graph = land_graph2, 
                  pred_graph = graph_gab_geo,
                  mode = "mcc", 
                  directed = FALSE)
#> Matthews Correlation Coefficient : 0.541875568864072
#> [1] 0.5418756

We get a Matthews’ correlation coefficient of 0.54. This coefficient takes a value of 0 when the matches between topologies are no more frequent than by simple chance. It reaches 1 when the topologies are identical.

Besides, you can compare the topologies of two graphs sharing the same nodes visually. To that purpose, their links are displayed on a map with a color depending on their presence in both graphs or in only one of them. The function graph_plot_compar can be used:

graph_plot_compar(x = land_graph2, y = graph_gab_geo, 
                  crds = crds_patches)

Studies on graph theory developed a range of metrics. Among them, some are computed at the node level. Hence, two graphs sharing the same nodes can be compared by correlating the metrics computed at the node level in both graphs. These metrics can also be correlated to other variables characterizing the nodes, such as the allelic richness. The function graph_node_compar allows to compute such correlations. The metrics which can be computed at the node level are: the degree, the closeness centrality, the betweenness centrality, the strength (sum of the weights of the links connected to a node), the sum or the mean of the weights of links connected to a node (Koen, Bowman, and Wilson 2016). Besides, other variables can be studied by associating them to the graph’s nodes as attributes with the function add_nodes_attr. Pearson’s, Kendall’s and Spearman’s correlation coefficients between the metrics or variables can be computed. A significance test can then be performed.

In the following example, the betweenness centrality index is computed in both graphs. Then, Spearman’s correlation coefficient is computed.

graph_node_compar(x = graph_gab_geo, y = land_graph2,
                  metrics = c("btw", "btw"), method = "spearman",
                  weight = TRUE, test = TRUE)
#> [[1]]
#> [1] "Metric from graph x: btw"
#> 
#> [[2]]
#> [1] "Metric from graph y: btw"
#> 
#> [[3]]
#> [1] "Method used: spearman's correlation coefficient"
#> 
#> [[4]]
#> [1] "Sample size: 50"
#> 
#> [[5]]
#> [1] "Correlation coefficient: 0.435435371318489"
#> 
#> [[6]]
#> [1] "p-value of the significance test: 0.00157527417929113"

The function graph_modul_compar compares the nodes partitions into modules. To do that, it computes the Adjusted Rand Index (ARI) (Hubert and Arabie 1985), a standardised index which counts the number of nodes pairs classified in the same module in both graphs. The function also performs the nodes partition into modules by using the modularity calculations available from igraph. You can specify the algorithm used to compute the modularity, the link weighting, the number of modules, among others (cf. function plot_graph_modul).

In the following example, we compare the same graphs as previously with the default parameters (‘fast_greedy’ algorithm, optimal number of modules, links weighted by inverse distances).

graph_modul_compar(x = land_graph2, y = graph_gab_geo)
#> [1] "6 modules in graph 1 and 6 modules in graph 2"
#> [1] "Adjusted Rand Index: 0.667565013147675"
#> [1] 0.667565

The ARI value is relatively high. There are 6 modules in both graph partitions.

References

Blondel, Vincent D, Jean-Loup Guillaume, Renaud Lambiotte, and Etienne Lefebvre. 2008. “Fast Unfolding of Communities in Large Networks.” Journal of Statistical Mechanics - Theory and Experiment 10.

Bowcock, Anne M, A Ruiz-Linares, James Tomfohrde, Eric Minch, Judith R Kidd, and L Luca Cavalli-Sforza. 1994. “High Resolution of Human Evolutionary Trees with Polymorphic Microsatellites.” Nature 368 (6470): 455–57.

Brandes, Ulrik, Daniel Delling, Marco Gaertler, Robert Gorke, Martin Hoefer, Zoran Nikoloski, and Dorothea Wagner. 2008. “On Modularity Clustering.” IEEE Transactions on Knowledge and Data Engineering 20 (2): 172–88.

Clauset, Aaron, Mark EJ Newman, and Cristopher Moore. 2004. “Finding Community Structure in Very Large Networks.” Physical Review E 70 (6).

Csardi, Gabor, and Tamas Nepusz. 2006. “The Igraph Software Package for Complex Network Research.” International Journal of Complex Systems 1695 (5): 1–9.

Dyer, Rodney J. 2009. “GeneticStudio: A Suite of Programs for Spatial Analysis of Genetic-Marker Data.” Molecular Ecology Resources 9 (1): 110–13.

Dyer, Rodney J, and John D Nason. 2004. “Population Graphs: The Graph Theoretic Shape of Genetic Structure.” Molecular Ecology 13 (7): 1713–27.

Excoffier, Laurent, Peter E Smouse, and Joseph M Quattro. 1992. “Analysis of Molecular Variance Inferred from Metric Distances Among Dna Haplotypes: Application to Human Mitochondrial Dna Restriction Data.” Genetics 131 (2): 479–91.

Foltête, Jean-Christophe, Céline Clauzel, and Gilles Vuidel. 2012. “A Software Tool Dedicated to the Modelling of Landscape Networks.” Environmental Modelling & Software 38: 316–27.

Fortuna, Miguel A, Rafael G Albaladejo, Laura Fernández, Abelardo Aparicio, and Jordi Bascompte. 2009. “Networks of Spatial Genetic Variation Across Species.” Proceedings of the National Academy of Sciences 106 (45): 19044–9.

Fruchterman, Thomas MJ, and Edward M Reingold. 1991. “Graph Drawing by Force-Directed Placement.” Software: Practice and Experience 21 (11): 1129–64.

Gabriel, K Ruben, and Robert R Sokal. 1969. “A New Statistical Approach to Geographic Variation Analysis.” Systematic Zoology 18 (3): 259–78.

Hedrick, Philip W. 2005. “A Standardized Genetic Differentiation Measure.” Evolution 59 (8): 1633–8.

Hubert, Lawrence, and Phipps Arabie. 1985. “Comparing Partitions.” Journal of Classification 2 (1): 193–218.

Hutchison, Delbert W, and Alan R Templeton. 1999. “Correlation of Pairwise Genetic and Geographic Distance Measures: Inferring the Relative Influences of Gene Flow and Drift on the Distribution of Genetic Variability.” Evolution 53 (6): 1898–1914.

Jombart, Thibaut. 2008. “Adegenet: A R Package for the Multivariate Analysis of Genetic Markers.” Bioinformatics 24 (11): 1403–5.

Jost, Lou. 2008. “GST and Its Relatives Do Not Measure Differentiation.” Molecular Ecology 17 (18): 4015–26.

Khimoun, Aurélie, William Peterman, Cyril Eraud, Bruno Faivre, Nicolas Navarro, and Stéphane Garnier. 2017. “Landscape Genetic Analyses Reveal Fine-Scale Effects of Forest Fragmentation in an Insular Tropical Bird.” Molecular Ecology.

Koen, Erin L, Jeff Bowman, and Paul J Wilson. 2016. “Node-Based Measures of Connectivity in Genetic Networks.” Molecular Ecology Resources 16 (1): 69–79.

Landguth, Erin L, and SA Cushman. 2010. “CDPOP: A Spatially Explicit Cost Distance Population Genetics Program.” Molecular Ecology Resources 10 (1): 156–61.

Matthews, Brian W. 1975. “Comparison of the Predicted and Observed Secondary Structure of T4 Phage Lysozyme.” Biochimica et Biophysica Acta (BBA)-Protein Structure 405 (2): 442–51.

Murphy, Melanie, Rodney Dyer, and Samuel A. Cushman. 2015. “Graph Theory and Network Models in Landscape Genetics.” In Landscape Genetics: Concepts, Methods, Applications, edited by Niko Balkenhol, Samuel Cushman, Andrew Storfer, and Lisette Waits, 1st ed., 165–80. John Wiley & Sons.

Naujokaitis-Lewis, Ilona R, Yessica Rico, John Lovell, Marie-Josée Fortin, and Melanie A Murphy. 2013. “Implications of Incomplete Networks on Estimation of Landscape Genetic Connectivity.” Conservation Genetics 14 (2): 287–98.

Paradis, Emmanuel. 2010. “Pegas: An R Package for Population Genetics with an Integrated–Modular Approach.” Bioinformatics 26 (3): 419–20.

Paschou, Peristera, Petros Drineas, Evangelia Yannaki, Anna Razou, Katerina Kanaki, Fotis Tsetsos, Shanmukha Sampath Padmanabhuni, et al. 2014. “Maritime Route of Colonization of Europe.” Proceedings of the National Academy of Sciences.

Pons, Pascal, and Matthieu Latapy. 2006. “Computing Communities in Large Networks Using Random Walks.” J. Graph Algorithms Appl. 10 (2): 191–218.

Pritchard, Jonathan K, Matthew Stephens, and Peter Donnelly. 2000. “Inference of Population Structure Using Multilocus Genotype Data.” Genetics 155 (2): 945–59.

Raymond, Michel. 1995. “GENEPOP: Population Genetics Software for Exact Tests and Ecumenism. Vers. 1.2.” Journal of Heredity 86: 248–49.

Rousset, François. 1997. “Genetic Differentiation and Estimation of Gene Flow from F-Statistics Under Isolation by Distance.” Genetics 145 (4): 1219–28.

Rozenfeld, Alejandro F, Sophie Arnaud-Haond, Emilio Hernández-Garcı́a, Vı́ctor M Eguı́luz, Ester A Serrão, and Carlos M Duarte. 2008. “Network Analysis Identifies Weak and Strong Links in a Metapopulation System.” Proceedings of the National Academy of Sciences 105 (48): 18824–9.

Shirk, AJ, EL Landguth, and SA Cushman. 2017. “A Comparison of Indiviudal-Based Genetic Distance Metrics for Landscape Genetics.” Molecular Ecology 17 (6).

Tournant, Pierline, Eve Afonso, Sébastien Roué, Patrick Giraudoux, and Jean-Christophe Foltête. 2013. “Evaluating the Effect of Habitat Connectivity on the Distribution of Lesser Horseshoe Bat Maternity Roosts Using Landscape Graphs.” Biological Conservation 164: 39–49.

Urban, Dean L, Emily S Minor, Eric A Treml, and Robert S Schick. 2009. “Graph Models of Habitat Mosaics.” Ecology Letters 12 (3): 260–73.

Van Strien, Maarten J, Rolf Holderegger, and Hein J Van Heck. 2015. “Isolation-by-Distance in Landscapes: Considerations for Landscape Genetics.” Heredity 114 (1): 27.

Wagner, Helene H, and Marie-Josée Fortin. 2013. “A Conceptual Framework for the Spatial Analysis of Landscape Genetic Data.” Conservation Genetics 14 (2): 253–61.

Weir, Bruce S, and C Clark Cockerham. 1984. “Estimating F-Statistics for the Analysis of Population Structure.” Evolution 38 (6): 1358–70.