View source: R/gen_graph_topo.R
gen_graph_topo | R Documentation |
The function constructs a genetic graph with a specific topology from genetic and/or geographical distance matrices
gen_graph_topo(mat_w, mat_topo = NULL, topo = "gabriel", k = NULL)
mat_w |
A symmetric (pairwise) |
mat_topo |
(optional) A symmetric (pairwise) distance |
topo |
Which topology does the created graph have?
|
k |
(if 'topo = 'knn”) An integer which indicates the number of nearest neighbors considered to create the K-nearest neighbor graph. k must be lower than the total number of nodes minus 1. |
If 'mat_topo' is not defined, 'mat_w' is used for the pruning. Matrices 'mat_w' and 'mat_topo' must have the same dimensions and the same rows' and columns' names. Values in 'mat_topo' matrix must be positive. Negative values from 'mat_w' are transformed into zeros. The function works only for undirected graphs. Note that the topology 'knn' works best when 'mat_topo' contains distance values from a continuous value range, thereby avoiding equal distances between a node and the others. are more than k nodes located at distances in the k-th smallest distances If dist objects are specified, it is assumed that colnames and row.names of mat_w and mat_topo refer to the same populations/locations.
A graph object of class igraph
P. Savary
gabriel1969newgraph4lg
mat_w <- mat_gen_dist(x = data_ex_genind, dist = 'DPS') suppressWarnings(mat_topo <- mat_geo_dist(pts_pop_ex, ID = "ID", x = "x", y = "y")) mat_topo <- mat_topo[row.names(mat_w), colnames(mat_w)] graph <- gen_graph_topo(mat_w, mat_topo, topo = "mst")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.