Learn R Programming

largeVis (version 0.2.1.1)

neighborsToVectors: A utility function to convert a k-NN graph to a pair of 0-indexed vectors of indices.

Description

In the returned list, the nodes indexed by `j` are the identified nearest neighbors of the nodes indexed by `i`. In other words, if `i = c(0,0,0,1,1,1)` and `j = c(1,2,3,2,3,4)`, then nodes `1, 2 & 3` are nearest neighbors of node 0, but node 0 is not a nearest neighbor of node 1.

Usage

neighborsToVectors(x)

Arguments

x

A `[K,N]` matrix of indices of the nearest neighbors of each vertex. 0-indexed.

Value

A list with fields:

i

The slowly-varying indices of x

j

The quickly-varying indices of x