create.iterated.iknn.graphs: Create iterated graph-geodesic iKNN graphs

View source: R/geodesic_iknn_graphs.R

create.iterated.iknn.graphsR Documentation

Create iterated graph-geodesic iKNN graphs

Description

Constructs G0 with create.iknn.graphs(), then constructs G1, G2, ..., Gm by repeatedly applying create.geodesic.iknn.graph() to each graph in the kmin:kmax sequence. This implements the iterated nerve rule

\{i,j\} \in E(G_{t+1}) \iff kNN_{G_t}(i) \cap kNN_{G_t}(j) \ne \emptyset,

with edge length

\ell_{t+1}(i,j) = d_{G_t}(i,j).

Usage

create.iterated.iknn.graphs(
  X,
  kmin,
  kmax,
  n.iterations = 3L,
  max.path.edge.ratio.deviation.thld = 0,
  path.edge.ratio.percentile = 0.5,
  threshold.percentile = 0,
  pca.dim = 100,
  variance.explained = 0.99,
  n.cores = 1L,
  parallel.mode = c("auto", "k", "bucket", "hybrid", "bucket.prune"),
  hybrid.batch.size = 2L,
  verbose = TRUE,
  knn.cache.path = NULL,
  knn.cache.mode = c("none", "read", "write", "readwrite")
)

Arguments

X

Numeric matrix with rows as observations and columns as features.

kmin

Integer minimum k.

kmax

Integer maximum k.

n.iterations

Non-negative integer number of geodesic rebuilds after G0. The default 3 returns G0, G1, G2, and G3.

max.path.edge.ratio.deviation.thld, path.edge.ratio.percentile, threshold.percentile

Initial G0 pruning arguments forwarded to create.iknn.graphs(). The default deviation and quantile thresholds are zero so that G0 is the unpruned iKNN 1-skeleton.

pca.dim, variance.explained, n.cores, parallel.mode, hybrid.batch.size, verbose, knn.cache.path, knn.cache.mode

Additional arguments forwarded to create.iknn.graphs() for the initial G0 construction.

Value

A list of class "iterated_iknn_graphs" with entries:

k_values

Integer vector of requested k values.

n_iterations

Number of geodesic rebuilds after G0.

initial_graphs

The "iknn_graphs" object returned by create.iknn.graphs() for G0.

graphs

Nested list named G0, G1, ...; each entry is a named list of graph objects for kmin:kmax.

summary

Data frame with one row per iteration and k.

Examples

set.seed(1)
X <- matrix(rnorm(30), ncol = 2)
out <- create.iterated.iknn.graphs(X, kmin = 2, kmax = 3, n.iterations = 1,
                                   verbose = FALSE)
out$summary


dgraphs documentation built on Aug. 21, 2026, 1:08 a.m.