iVAE.utils.graph_connection
- iVAE.utils.graph_connection(graph: csr_matrix, labels: ndarray)[source]
Compute graph connectivity score for each cluster.
This metric measures how well connected cells within each cluster are in the k-nearest neighbor graph. Higher values indicate better connectivity.
- Parameters:
graph (scipy.sparse.csr_matrix) – Sparse adjacency matrix representing the k-nearest neighbor graph.
labels (numpy.ndarray) – Cluster labels for each cell.
- Returns:
Average connectivity score across all clusters (range: 0 to 1). Higher values indicate cells in the same cluster are well-connected.
- Return type:
float