[adegenet-forum] Calculating Distances from a connection Network
Jombart, Thibaut
t.jombart at imperial.ac.uk
Thu Jun 4 12:16:12 CEST 2015
Hi there,
yes, the simplest way might be to get the adjacency matrix from the graph and then multiply it by the matrix of geographic distances. Example using nancycats:
## get network
library(adegenet)
data(nancycats)
cn1 <- chooseCN(nancycats at other$xy,ask=FALSE,type=1)
## get adj matrix
M <- neig2mat(nb2neig(cn1))
## get geo dist matrix
G <- as.matrix(dist(other(nancycats)$xy))
## get distances on Delaunay graph
d.delau <- G[M>0]
## range
range(d.delau)
Cheers
Thibaut
==============================
Dr Thibaut Jombart
MRC Centre for Outbreak Analysis and Modelling
Department of Infectious Disease Epidemiology
Imperial College - School of Public Health
Norfolk Place, London W2 1PG, UK
Tel. : 0044 (0)20 7594 3658
http://sites.google.com/site/thibautjombart/
http://sites.google.com/site/therepiproject/
http://adegenet.r-forge.r-project.org/
Twitter: @thibautjombart
________________________________
From: adegenet-forum-bounces at lists.r-forge.r-project.org [adegenet-forum-bounces at lists.r-forge.r-project.org] on behalf of Phair, D, Mnr <16187393 at sun.ac.za> [16187393 at sun.ac.za]
Sent: 03 June 2015 13:57
To: adegenet-forum at lists.r-forge.r-project.org
Subject: [adegenet-forum] Calculating Distances from a connection Network
Hi there
I am a Masters student running an MSPA to look for Spatial structuring in an invasive species in a South African and Australian context. I am able to run the analyses with no apparent issues but was wondering if anyone knew of a method to calculate the minimum and maximum distances from a Delaunay triangulation connection network.
The reason being that i would like to compare my results between South Africa and Australia but want to be sure the connection extents are comparable. i.e. that the minimum/maximum distance between connected individuals are similar within South Africa and Australia.
I am fairly new to both R and Adegenet and so have only a basic working knowledge.
Regards
David Phair
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/adegenet-forum/attachments/20150604/97b245e0/attachment.html>
More information about the adegenet-forum
mailing list