Skip to content

K Distance Graph

Group (Subgroup)

DREAM3D Review (Clustering)


This Filter computes the distance between each point and its kth nearest neighbor. For example, if \f$ k = 1 \f$, this Filter will store the distance bewteen each point and its closest nearest neighbor (i.e., the distance that is smallest among all pair-wise distances). The user may select from a number of options to use as the distance metric. When sorted smallest-to-largest, the k distance array forms a graph that is useful for estimating parameters in some clustering algorithms, such as DBSCAN. The user may opt to use a mask array to ignore points in the distance computation; these points will contain a distance value of 0 in the output array.


Name Type Description
Kth Nearest Neighbor int32_t Which nearest neighbor for which to compute the distance
Distance Metric Enumeration The metric used to determine the distances between points
Use Mask bool Whether to use a boolean mask array to ignore certain points flagged as false from the algorithm

Required Geometry


Required Objects

Kind Default Name Type Component Dimensions Description
Any Attribute Array None Any Any The Attribute Array for which the compute the kth nearest neighbor distances
Attribute Array Mask bool (1) Specifies if the point is to be counted in the algorithm, if Use Mask is checked

Created Objects

Kind Default Name Type Component Dimensions Description
Attribute Array KDistance double (1) Distance to the kth nearest neighbor for each point

Example Pipelines

Please see the description file distributed with this plugin.

DREAM3D Mailing Lists

If you need more help with a filter, please consider asking your question on the DREAM3D Users mailing list:!forum/dream3d-users