Skip to contents

Constructs a graph representation of a basin complex, where nodes represent basins (local maxima and minima) and edges represent their relationships. Edges are weighted based on basin overlap, function value differences, or other basin metrics.

Usage

construct.basin.cx.graph(
  basin_cx,
  min_intersection = 1,
  ms_edges_only = FALSE,
  weight_type = c("dice", "jaccard", "overlap", "y_diff")
)

Arguments

basin_cx

A basin complex object of class "basin_cx" returned by create.basin.cx()

min_intersection

Minimum number of vertices that must be shared between basins for an edge to be created (default: 1)

ms_edges_only

Logical; if TRUE, only include edges between ascending and descending basins, ignoring ascending-ascending and descending-descending connections (default: FALSE)

weight_type

Character string specifying the edge weight metric to use. Options are: "dice" (Dice-Sorensen similarity), "jaccard" (Jaccard index), "overlap" (overlap size), or "y_diff" (function value difference) (default: "dice")

Value

A list with class "basin_cx_graph" containing:

adjacency_list

List of adjacency lists for the basin complex graph

weights_list

List of edge weights

intersection_matrix

Matrix where [i,j] is the number of vertices shared between basins i and j

similarity_matrix

Matrix of similarity values (based on weight_type) between basins

y_diff_matrix

Matrix of function value differences between extrema

basin_metadata

Data frame with information about each basin (type, extremum index, etc.)

n_ascending

Number of ascending basins

n_descending

Number of descending basins

weight_type

The type of weight metric used

Details

This function creates a graph where nodes represent basins (either local minima or maxima) and edges represent relationships between them. The resulting graph provides insight into the topological structure of the function on the original graph.

Edge weights can be based on different metrics:

  • dice: Dice-Sorensen similarity index \((2|A \cap B|/(|A| + |B|))\)

  • jaccard: Jaccard similarity index \((|A \cap B|/|A \cup B|)\)

  • overlap: Raw number of vertices in the intersection

  • y_diff: Absolute difference in function value between extrema

When ms_edges_only = TRUE, only edges between an ascending basin (minimum) and a descending basin (maximum) are included, producing a bipartite graph.

See also