graph.summary.divergence: Compute divergence between two graphs using a selected graph...

View source: R/graph_summary_divergence.R

graph.summary.divergenceR Documentation

Compute divergence between two graphs using a selected graph summary

Description

Extracts one selected graph summary from two graph-like objects and computes a divergence between the resulting probability mass functions.

Currently the supported divergence is Jensen-Shannon divergence, implemented via jensen.shannon.divergence().

Usage

graph.summary.divergence(
  g1,
  g2,
  summary = c("degree_distribution", "edge_weight_distribution",
    "component_size_distribution", "neighborhood_label_distribution"),
  divergence = c("js"),
  labels = NULL,
  summary.args = list(),
  support = NULL,
  return.details = TRUE
)

Arguments

g1

First graph-like object.

g2

Second graph-like object.

summary

Summary type to compare.

divergence

Divergence type. Currently only "js".

labels

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

summary.args

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

support

Optional common support. If NULL, the union of the two PMF supports is used.

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.

  • value: scalar divergence value.

  • pmf1: aligned PMF for g1.

  • pmf2: aligned PMF for g2.

  • support: aligned support.

  • metadata: summary-specific metadata for both graphs.

Otherwise, returns the scalar divergence value.


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