Define a function convert nn list to adjacency matrix that can be further used for igraph

NN2M(nn)

Arguments

nn

nn list, which has two components: nn$idx and nn$dist

Value

return an nn.matrix. This is adjacency matrix can be input to igraph graph<-graph_from_adjacency_matrix(nn.matrix,diag = F,mode = "undirected")