calculate.edit.distances: Calculate Edit Distances Between Sequential Graphs

View source: R/graph_edit_distance.R

calculate.edit.distancesR Documentation

Calculate Edit Distances Between Sequential Graphs

Description

Calculates edit distances between pairs of graphs separated by a specified offset in the sequence of k values.

Usage

calculate.edit.distances(
  k.values,
  graph.data,
  offset = 1,
  edge.cost = 1,
  weight.cost.factor = 0.1,
  verbose = FALSE
)

Arguments

k.values

Numeric vector of k values corresponding to the loaded graphs.

graph.data

List containing graph data as produced by load.graph.data.

offset

Positive integer specifying the offset between compared graphs (default: 1). An offset of 1 compares consecutive graphs.

edge.cost

Cost parameter passed to graph.edit.distance (default: 1).

weight.cost.factor

Weight cost factor passed to graph.edit.distance (default: 0.1).

verbose

Logical indicating whether to show progress messages (default: FALSE).

Details

For a sequence of k values and an offset of 1, this function compares:

  • Graph at k[1] with graph at k[2]

  • Graph at k[2] with graph at k[3]

  • And so on...

Value

A list containing:

indices

Integer vector of indices in the k.values sequence

k.values

Numeric vector of k values corresponding to the first graph in each comparison

distances

Numeric vector of calculated edit distances

Examples

graph.data <- list(
  adj.list = list(
    `5` = list(c(2), c(1, 3), c(2)),
    `10` = list(c(2, 3), c(1, 3), c(1, 2)),
    `15` = list(c(2, 3), c(1), c(1))
  ),
  dist.list = list(
    `5` = list(1, c(1, 2), 2),
    `10` = list(c(1, 2), c(1, 3), c(2, 3)),
    `15` = list(c(1, 1.5), 1, 1.5)
  )
)
k.vals <- c(5, 10, 15)
distances <- calculate.edit.distances(k.vals, graph.data, offset = 1)
distances$distances


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