create_balls function

Make a cover of balls

Make a cover of balls

create_balls(data, dists, eps)

Arguments

  • data: A data frame.
  • dists: A distance matrix for the data frame.
  • eps: A positive real number.

Returns

A list of vectors of data point names, one list element per ball. The output is such that every data point is contained in a ball of radius ε\varepsilon, and no ball center is contained in more than one ball. The centers are datapoints themselves.

Examples

num_points = 5000 P.data = data.frame( x = sapply(1:num_points, function(x) sin(x) * 10) + rnorm(num_points, 0, 0.1), y = sapply(1:num_points, function(x) cos(x) ^ 2 * sin(x) * 10) + rnorm(num_points, 0, 0.1), z = sapply(1:num_points, function(x) 10 * sin(x) ^ 2 * cos(x)) + rnorm(num_points, 0, 0.1) ) P.dist = dist(P.data) balls = create_balls(data = P.data, dists = P.dist, eps = .25)
  • Maintainer: George Clare Kennedy
  • License: MIT + file LICENSE
  • Last published: 2025-02-20