compute_dc_distances: Compute density-connectivity (DC) distances

View source: R/disco.R

compute_dc_distancesR Documentation

Compute density-connectivity (DC) distances

Description

The main entry point for constructing the DC-distance matrix used throughout the DISCO metric. The procedure is:

  1. Compute core distances and build the minimum spanning tree of the mutual-reachability distances (see calculate_reachability_distance). Since version 0.2.0 the tree is built in compiled code with distances computed on the fly, so the mutual-reachability matrix is never stored.

  2. Extract pairwise DC distances as minimax-path weights in the MST (extract_dc_distances_from_mst).

Note that the returned matrix has n^2 entries; disco_samples and disco_score do not need it and use far less memory.

Usage

compute_dc_distances(X, min_points = 5)

Arguments

X

A numeric matrix of shape n \times p, or a data.frame that will be coerced to a matrix.

min_points

A positive integer for the core-distance neighbourhood size. Default is 5.

Value

A symmetric n \times n numeric matrix of DC distances.

Examples

set.seed(1)
X <- matrix(rnorm(40), ncol = 2)
D <- compute_dc_distances(X, min_points = 5)
dim(D)   # 20 x 20

discoCVI documentation built on Oct. 28, 2026, 1:07 a.m.