Skip to contents

Computes stability diagnostics across the pruned IkNN graphs produced by create.iknn.graphs(). Metrics include edit distances between consecutive graphs, graph-summary Jensen-Shannon divergence, edge-count diagnostics, local minima, and smoothed trend fits for plotting.

Usage

compute.stability.metrics(
  graphs,
  graph.type = c("geom", "isize"),
  summary = c("degree_distribution", "edge_weight_distribution",
    "component_size_distribution", "neighborhood_label_distribution"),
  divergence = c("js"),
  labels = NULL,
  summary.args = list()
)

Arguments

graphs

An object of class "iknn_graphs" returned by create.iknn.graphs().

graph.type

Character string, either "geom" or "isize".

summary

Graph-summary family used for the divergence curve.

divergence

Divergence used for consecutive-graph comparison. Currently only "js".

labels

Optional vertex-label vector used when summary = "neighborhood_label_distribution".

summary.args

Optional named list forwarded to compute.graph.summary.stability().

Value

An object of class "iknn_stability_metrics".

Examples

set.seed(1)
x <- matrix(rnorm(60), ncol = 2)
graphs <- create.iknn.graphs(x, k.values = seq.int(2, 4), compute.full = TRUE,
    verbose = FALSE)
stability <- compute.stability.metrics(graphs)
stability$edit.distances
#> [1] 26 19