load.graph.data: Load Graph Data from RDA Files

View source: R/graph_edit_distance.R

load.graph.dataR Documentation

Load Graph Data from RDA Files

Description

Loads pruned graph data from a series of RDA files for different k values and combines them into a list structure containing adjacency and distance lists.

Usage

load.graph.data(
  k.values,
  prefix,
  suffix = "_NN_graph.rda",
  graph.object.name = "S.graph",
  verbose = TRUE
)

Arguments

k.values

Numeric vector of k values to process. Must be positive integers.

prefix

Character string specifying the path and prefix of the RDA files.

suffix

Character string specifying the suffix of the RDA files (default: "_NN_graph.rda").

graph.object.name

Character string specifying the name of the graph object stored in the RDA files (default: "S.graph").

verbose

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

Details

The function expects RDA files to be named according to the pattern: paste0(prefix, k, suffix) for each k value.

Each RDA file should contain an object with the name specified in graph.object.name, which must have components pruned_adj_list and pruned_dist_list.

Value

A list containing two components:

adj.list

Named list of adjacency lists, one for each k value

dist.list

Named list of distance lists, one for each k value

Examples

prefix <- file.path(tempdir(), "dgraphs-k")
S.graph <- list(
  pruned_adj_list = list(c(2L), c(1L)),
  pruned_dist_list = list(1, 1)
)
save(S.graph, file = paste0(prefix, 2, ".rda"))
graph.data <- load.graph.data(
  2, prefix = prefix, suffix = ".rda", verbose = FALSE
)
unlink(paste0(prefix, 2, ".rda"))
names(graph.data$adj.list)


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