trimNeighbors: Trim Neighbors

View source: R/cluster.R

trimNeighborsR Documentation

Trim Neighbors

Description

Further reduce the cutoff value of a nearest neighbor (NN) table, as produced by nearestNeighbors. This allows one to compute a very relaxed NN table initially, and then quickly restrict it later without having to re-compute all the similarities.

Usage

   trimNeighbors(nnm, cutoff)

Arguments

nnm

A nearest neighbor table, as produced by nearestNeighbors.

cutoff

The new similarities cutoff value. All pairs with a similarity less than this value will be removed from the table.

Value

The return value has the same structure as nnm, with some neighbors removed from the indexes and similarties entries.

Author(s)

Kevin Horan

See Also

jarvisPatrick nearestNeighbors

Examples


   data(sdfsample)
   ap = sdf2ap(sdfsample)
   nnm = nearestNeighbors(ap,numNbrs=20)
   nnm = trimNeighbors(nnm,cutoff=0.5)
   clustering = jarvisPatrick(nnm,k=2,mode="a1b")

girke-lab/ChemmineR documentation built on July 28, 2023, 10:36 a.m.