Skip to contents

Applies multiple harmonic extension methods to a subgraph around an extremum and compares their results using various metrics.

Usage

# S3 method for class 'harmonic.methods'
compare(
  subgraph,
  methods = c("weighted_mean", "harmonic_iterative", "harmonic_eigen",
    "biharmonic_harmonic", "boundary_smoothed"),
  max_iterations = 100,
  tolerance = 1e-06,
  sigma = 1,
  plot_results = TRUE,
  plot_type = c("2d", "3d")
)

Arguments

subgraph

A subgraph object created by extract.extrema.subgraphs

methods

Character vector of method names to test (default: all available methods)

max_iterations

Maximum number of iterations for iterative methods (default: 100)

tolerance

Convergence tolerance (default: 1e-6)

sigma

Parameter for weighted mean method (default: 1.0)

plot_results

Logical whether to visualize the results (default: TRUE)

plot_type

Character string specifying visualization type if plot_results = TRUE: "2d" or "3d" (default: "3d")

Value

A list containing:

results

Named list of results from each method

metrics

Data frame with comparison metrics for each method:

  • method: Method name

  • iterations: Number of iterations performed

  • final_change: Final iteration change

  • converged: Whether method converged

  • total_change: Sum of absolute changes from original

  • extremum_removal: Change at the extremum vertex

subgraph

The input subgraph object

Examples

if (FALSE) { # \dontrun{
# Assumes subgraph was created by extract.extrema.subgraphs
comparison <- compare.harmonic.methods(
  subgraph,
  methods = c("harmonic_iterative", "harmonic_eigen")
)
} # }