Function which maps multidimensional data to one dimension while preserving locality of the data points