Compute subject-specific sparse connectivity graph `W_conn_i`
Source:R/spectral_graph_construction.R
compute_subject_connectivity_graph_sparse.Rd
Calculates the sparse connectivity graph for a single subject. Steps: 1. Compute pairwise Pearson correlations using a memory-efficient cross-product approach that avoids constructing a dense `V_p` `V_p` matrix. 2. Identify and mask zero-variance parcels. 3. Sparsify: For each parcel, identify indices of `k_conn_pos` strongest positive and `k_conn_neg` strongest negative correlations, using partial sort. Exclude zero-variance parcels from selection candidates. Construct a directed sparse graph `W_dir` from these. 4. Symmetrize `W_dir` using `W_sym_raw = (W_dir + t(W_dir)) / 2`, then `drop0`. 5. Ensure strict symmetry for z-scoring: `W_symmetric = Matrix::forceSymmetric(W_sym_raw, uplo="U")`. 6. Z-score non-zero edge weights in `W_symmetric` (assumes `zscore_nonzero_sparse` is stable).
Usage
compute_subject_connectivity_graph_sparse(
X_subject,
parcel_names,
k_conn_pos,
k_conn_neg,
use_dtw = FALSE
)
Arguments
- X_subject
A numeric matrix of time-series data for one subject (`T_i` time points x `V_p` parcels).
- parcel_names
A character vector of parcel names.
- k_conn_pos
An integer, number of positive connections to retain per node.
- k_conn_neg
An integer, number of negative connections to retain per node.
- use_dtw
Logical, defaults to `FALSE`. (Placeholder).