library(sf)
data(ralu.site, package="GeNetIt")
p <- as(ralu.site, "sf")
g <- knn.graph(p[c(1,5,8,10,20,31),])
plot(st_geometry(g))
( ind <- sf::st_drop_geometry(g[,1:2])[1:10,] )
adj_matrix(ind)
adj_matrix(g$i[1:10], g$j[1:10])
Run the code above in your browser using DataLab