Skip to contents

Computes a divergence-based stability curve across consecutive graphs in a sequence. This function provides a generalized sequence-level analogue of the degree-profile Jensen-Shannon calculation currently used in compute.stability.metrics().

Usage

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

Arguments

graphs

Either a list of graph-like objects or an object of class "iknn_graphs".

summary

Summary type to compare across consecutive graph pairs.

divergence

Divergence type. Currently only "js".

labels

Optional shared vertex-label vector used for "neighborhood_label_distribution".

summary.args

Optional named list forwarded to graph.summary.divergence().

k.values

Optional integer vector of k values. If graphs is an "iknn_graphs" object and k.values is NULL, the values are derived from its k.values attribute.

graph.type

If graphs is an "iknn_graphs" object, choose either "geom" or "isize".

return.details

Logical; if TRUE, return a structured list.

Value

If return.details = TRUE, a list with fields:

  • summary: summary type used.

  • divergence: divergence type used.

  • k.values: full k sequence.

  • k.transition.values: k values corresponding to consecutive-graph transitions.

  • values: vector of divergence values of length length(k.values) - 1.

  • details: optional pairwise details for each transition.

Otherwise, returns only the divergence vector.

Examples

graphs <- list(
  dgraph(list(2L, c(1L, 3L), 2L)),
  dgraph(list(c(2L, 3L), c(1L, 3L), c(1L, 2L))),
  create.graph("complete", 3)
)
compute.graph.summary.stability(
  graphs,
  summary = "degree_distribution"
)$values
#> [1] 0.4591479 0.0000000