Skip to contents

Identifies local minima and maxima of a scalar function defined on the vertices of a graph, using a basin-based definition of extrema.

Usage

find.local.extrema(adj.list, weight.list, y, min.basin.size = 1L)

Arguments

adj.list

A list of integer vectors, where each element represents the neighbors of a vertex (1-based indices). Must match the length of y.

weight.list

A list of numeric vectors representing edge weights corresponding to the adjacency list structure.

y

A numeric vector of function values defined on the vertices of the graph.

min.basin.size

An integer specifying the minimum number of vertices required for a valid basin to be considered an extremum. Default is 1.

Value

An object of class "local_extrema_basins", which is a list with the following components:

basins

A list with elements ascending (minima) and descending (maxima), each containing a list of basins with vertex index, function value, and basin information.

local_extrema

A data frame summarizing all detected extrema with columns: vertex_index, is_maximum, label, and fn_value.

Details

This function uses a simpler algorithm than find.gflow.basins, focusing on local extrema detection without the geodesic flow analysis. Each extremum is associated with a basin of attraction obtained via a gradient flow process.

See also

find.gflow.basins for more comprehensive basin analysis

Examples

# Create a simple graph
adj.list <- list(c(2, 3), c(1, 3, 4), c(1, 2, 4), c(2, 3))
weight.list <- list(c(1, 1), c(1, 1, 1), c(1, 1, 1), c(1, 1))
y <- c(1, 0, 2, 1.5)

# \donttest{
# Find local extrema (requires compiled C++ backend)
result <- find.local.extrema(adj.list, weight.list, y, min.basin.size = 1)
print(result$local_extrema)
# }