This function analyzes the persistence of Morse-Smale graphs over a range of nearest neighbor values (k) for a given data matrix X and response variable y. It computes the nerve graphs and their associated Morse-Smale complex graphs for each k value and determines the isomorphism and deviation from isomorphism between consecutive Morse-Smale graphs.
Usage
morse.smale.graph.persistence(
X,
y,
Ks,
ref.MS.graph = NULL,
allow.disconnected.graph = TRUE,
verbose = FALSE
)Arguments
- X
A data matrix or data frame.
- y
A numeric vector representing the response variable over X.
- Ks
A vector of positive integer values specifying the range of k values.
- ref.MS.graph
A reference Morse-Smale graph. Usually, the Morse-Smale graph of the y over the full graph or of full dataset before subsampling. If ref.MS.graph is not NULL, is.isomorphic.with.ref.MS.graph and dev.from.isomorphism.with.MS.graph are computed.
- allow.disconnected.graph
Logical. If TRUE (default), the algorithm proceeds even if none of the nerve graphs associated with (X, y) are connected.
- verbose
If set to TRUE, it prints progress messages.
Value
A list with four components:
nerve.graph: A list of nerve graphs computed for each k value.
MS.graph: A list of Morse-Smale complex graphs computed for each k value.
are.consecutive.graphs.isomorphic: A vector indicating whether consecutive Morse-Smale graphs are isomorphic.
is.isomorphic.with.ref.MS.graph: A vector indicating whether the computed Morse-Smale graphs are isomorphic with the reference Morse-Smale graph.
first.index.of.longest.stretch.of.isomorphic.MS.graphs: The first index of the longest stretch of isomorphic MS graphs.
length.of.longest.stretch.of.isomorphic.MS.graphs: The length of the longest stretch of isomorphic MS graphs.