compute.graph.summary.pmf: Compute a graph summary as a probability mass function

View source: R/graph_summary_divergence.R

compute.graph.summary.pmfR Documentation

Compute a graph summary as a probability mass function

Description

Converts a graph-like object into a named probability mass function (PMF) describing one selected graph summary. This provides a standardized bridge between graph objects and divergence functions such as jensen.shannon.divergence().

Supported v1 summaries are:

  • "degree_distribution"

  • "edge_weight_distribution"

  • "component_size_distribution"

  • "neighborhood_label_distribution"

"component_size_distribution" is included primarily as a diagnostic for disconnectedness / fragmentation, not as a general-purpose default stability summary.

Usage

compute.graph.summary.pmf(
  graph,
  summary = c("degree_distribution", "edge_weight_distribution",
    "component_size_distribution", "neighborhood_label_distribution"),
  labels = NULL,
  weight.list = NULL,
  bins = NULL,
  n.bins = 20L,
  bin.method = c("auto", "fixed_width", "fixed_quantile", "explicit"),
  normalize = TRUE,
  support = NULL,
  zero.pad = TRUE,
  simplify.multiple = TRUE,
  directed = FALSE,
  return.details = TRUE
)

Arguments

graph

Graph-like object. Supported inputs are:

  • an object with adj_list and optional weight_list

  • an object with pruned_adj_list and optional pruned_weight_list

  • a plain adjacency list (list of integer vectors)

summary

Summary type to compute.

labels

Optional label vector used for "neighborhood_label_distribution". Must have length equal to the number of vertices.

weight.list

Optional edge-weight list used when graph is a plain adjacency list.

bins

Optional numeric vector of histogram breaks used for "edge_weight_distribution".

n.bins

Integer number of bins used when bins is NULL and the summary is "edge_weight_distribution".

bin.method

Character string controlling automatic bin construction for "edge_weight_distribution".

normalize

Logical; if TRUE, convert counts to a PMF.

support

Optional support to align the resulting PMF to.

zero.pad

Logical; if TRUE and support is provided, missing support entries are padded with zero mass.

simplify.multiple

Logical; if TRUE, duplicate edges are collapsed before computing summaries.

directed

Logical; if FALSE (default), treat edges as undirected.

return.details

Logical; if TRUE, return a structured list. Otherwise return the named PMF directly.

Value

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

  • summary: summary type used.

  • pmf: named probability mass function.

  • support: support of the PMF.

  • counts: named raw-count vector before normalization.

  • metadata: list of summary-specific metadata.

Otherwise, returns the named PMF vector.


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