Skip to contents

Merges two basins in a gradient flow complex by having one basin absorb another. The function updates the basin vertices, recomputes the cells based on the new basin configuration, and updates the local extrema table.

Usage

# S3 method for class 'merge'
basins(object, absorbing.label, absorbed.label, ...)

Arguments

object

An object of class "ggflow" returned by construct.graph.gradient.flow.

absorbing.label

Character string specifying the label of the basin that will absorb the other basin.

absorbed.label

Character string specifying the label of the basin that will be absorbed.

...

Additional arguments (currently ignored).

Value

A modified gradient flow object with merged basins and updated cells.

Details

The function identifies the type of basins (ascending or descending) from the label prefixes: "m" for minima (ascending basins) and "M" for maxima (descending basins). The absorbing basin incorporates all vertices from the absorbed basin, and the gradient flow structure is updated accordingly.

Examples

if (FALSE) { # \dontrun{
# Merge descending basins M2 and M3, with M2 absorbing M3
merged_flow <- basins.merge(flow, "M2", "M3")

# Check the updated structure
summary(merged_flow)
} # }