Skip to contents

Visualizes various aspects of a Morse-Smale complex computed on a graph, including the complex itself, cell graphs, branches of attraction, and the original graph with cell assignments. The graphMScx object is typically created by the graph.MS.cx function.

Usage

# S3 method for class 'graphMScx'
plot(
  x,
  type = c("MS_cx_graph", "MS_cx_nerve_graph", "lmin_BoA", "lmax_BoA", "MS_graphs",
    "MS_cell", "Ey"),
  i = 1,
  vertex.size = 2,
  vertex.label = NULL,
  show.only.lextr.labels = TRUE,
  edge.label.cex = 2,
  legend.cex = 1,
  lmin.color = "blue",
  lmax.color = "red",
  label.dist = 1.5,
  legend.position = "topleft",
  lext.sfactor = 5,
  ...
)

Arguments

x

A graphMScx object containing the results of Morse-Smale complex construction, as returned by graph.MS.cx

type

Character string specifying the type of plot to generate:

"MS_cx_graph"

Plot the Morse-Smale complex graph with vertices colored by type (local minimum/maximum) using a bipartite layout

"MS_cx_nerve_graph"

Plot the Cech (nerve) graph of the Morse-Smale complex with edges weighted by the number of shared vertices between cells

"lmin_BoA"

Plot the graph with vertices colored by their local minima branches of attraction

"lmax_BoA"

Plot the graph with vertices colored by their local maxima branches of attraction

"MS_graphs"

Plot a specific Morse-Smale cell subgraph (specify cell with parameter i)

"MS_cell"

Plot the entire graph highlighting a specific cell with vertices colored by function values

"Ey"

Plot the entire graph with vertices colored by function values (Ey)

i

Integer specifying the index of the Morse-Smale cell to plot when type = "MS_graphs" or type = "MS_cell". Default is 1.

vertex.size

Numeric scalar or vector specifying vertex sizes. For local extrema, this is scaled by lext.sfactor. Default is 2.

vertex.label

Character vector of vertex labels. If NULL (default), labels are determined based on show.only.lextr.labels.

show.only.lextr.labels

Logical. If TRUE (default), only show labels for local extrema vertices.

edge.label.cex

Numeric scalar controlling the size of edge labels in the Morse-Smale complex graph. Default is 2.

legend.cex

Numeric scalar controlling legend text size. Default is 1.

lmin.color

Color for local minima vertices. Default is "blue".

lmax.color

Color for local maxima vertices. Default is "red".

label.dist

Numeric scalar controlling the distance of vertex labels from vertices. Default is 1.5.

legend.position

Character string specifying legend position. Options include "topleft", "topright", "bottomleft", "bottomright". Default is "topleft".

lext.sfactor

Numeric scalar for scaling the size of local extrema vertices relative to regular vertices. Default is 5.

...

Additional arguments passed to plotting functions

Value

Invisible NULL. The function is called for its side effect of creating a plot.

Details

The function provides multiple visualization options for understanding the structure of the Morse-Smale complex:

  • The complex graph shows connections between critical points

  • Branch visualizations show which extrema influence each vertex

  • Cell visualizations show the decomposition of the graph

Local minima are displayed as downward-pointing triangles (blue by default), while local maxima are shown as upward-pointing triangles (red by default).

Note

This function requires the igraph package for graph visualization. The input object must be properly formatted with all required components from the Morse-Smale complex computation.

See also

graph.MS.cx for computing the Morse-Smale complex, ggraph for creating graph objects

Examples

if (FALSE) { # \dontrun{
# 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))
g <- ggraph(adj_list, weight_list)

# Define function values on vertices
Ey <- c(0.5, 0.3, 0.8, 0.2)

# Compute Morse-Smale complex
mscx <- graph.MS.cx(g, Ey)

# Plot the Morse-Smale complex graph
plot(mscx)

# Show branches of attraction for local minima
plot(mscx, type = "lmin_BoA")

# Plot a specific cell
plot(mscx, type = "MS_graphs", i = 2)

# Show the entire graph with first cell highlighted
plot(mscx, type = "MS_cell", i = 1)
} # }