g_percol: Prune a graph using the 'percolation threshold' method

Description Usage Arguments Value Author(s) Examples

View source: R/g_percol.R

Description

The function allows to prune a graph by removing the links with the largest weights until the graph breaks into two components. The returned graph is the last graph with only one component.

Usage

1
g_percol(x, val_step = 20)

Arguments

x

A symmetric matrix or a dist object with pairwise distances between nodes

val_step

The number of classes to create to search for the threshold value without testing all the possibilities. By default, 'val_step = 20'.

Value

A graph object of type igraph

Author(s)

P. Savary

Examples

1
2
3
4
5
6
data(data_ex_genind)
suppressWarnings(mat_w <- graph4lg::mat_geo_dist(data = pts_pop_ex,
                            ID = "ID",
                            x = "x",
                            y = "y"))
g_percol(x = mat_w)

Example output

Welcome to 'graph4lg' package. Let's do landscape genetics analysis with graphs
Coordinates were treated as projected coordinates. Check whether
              it is the case.
Number of conserved links : 20
Maximum weight of the conserved links : 19313.207915828
IGRAPH b07bb80 UNW- 10 20 -- 
+ attr: name (v/c), weight (e/n)
+ edges from b07bb80 (vertex names):
 [1] 1--6  2--3  2--4  2--5  3--5  3--6  4--5  5--6  5--7  5--8  5--9  6--8 
[13] 6--9  6--10 7--8  7--9  7--10 8--9  8--10 9--10

graph4lg documentation built on March 16, 2021, 5:09 p.m.