calculates a cost distance matrix, to be used with run.popgensim
costdistances(landscape, locs, method, NN)
a costdistance matrix between all pairs of locs
a raster object coding the resistance of the landscape
coordinates of the subpopulations
defines the type of cost distance, types are "least-cost", "rSPDistance" or "commute (Circuitscape type)"
number of next neighbours recommendation is 8