Skip to contents

Returns the set of domain-graph vertices assigned to a single basin (minimum or maximum) in a trajectory-first gfc.flow object (as produced by compute.gfc.flow).

Internally, the function resolves basin.id to an extremum label using gfc.flow$summary.all (preferred) or gfc.flow$summary, and then retrieves the basin structure via get.basin. The returned basin vertex set is basin$vertices.

Usage

# S3 method for class 'vertices'
basin(
  object,
  basin.id,
  type = c("auto", "min", "max"),
  include.extremum = TRUE,
  unique = TRUE,
  sort = TRUE,
  gfc.flow = object,
  ...
)

Arguments

object

A gfc.flow object from compute.gfc.flow.

basin.id

Basin identifier. Either:

  • a character extremum label (e.g., "M1", "m3", "sM2", "sm7"), or

  • a single numeric vertex index (1-based) corresponding to an extremum present in gfc.flow$summary.all / gfc.flow$summary.

type

Character string. Only used when basin.id is numeric. One of "auto" (default), "min", or "max". If "auto", the type is inferred from the summary table row matching basin.id.

include.extremum

Logical; if TRUE (default), ensure the extremum vertex is included in the returned set (defensive; typically already included).

unique

Logical; if TRUE (default), return unique vertices.

sort

Logical; if TRUE (default), sort returned vertices increasingly.

gfc.flow

Backward-compatible alias for object.

...

Additional arguments (currently ignored).

Value

An integer vector of basin vertex indices (1-based).

Examples

if (FALSE) { # \dontrun{
## By label
v.M1 <- basin.vertices(gfc.flow.res, "M1")

## By vertex (infer type from summary)
v.1147 <- basin.vertices(gfc.flow.res, 1147)

## By vertex with explicit type (useful if you ever have ambiguity)
v.min.509 <- basin.vertices(gfc.flow.res, 509, type = "min")
} # }