compute_medoid_indices_from_graph

fast_plscan.compute_medoid_indices_from_graph(graph, probabilities, labels)

Compute cluster medoid indices from a sparse mutual-reachability graph.

Assumes inputs are already validated. Within each cluster, computes the probability-weighted mean mutual reachability distance over reachable neighbours.

Parameters:
  • graph (SparseGraph | csr_array) – Sparse mutual-reachability graph as SparseGraph or csr_array.

  • probabilities (ndarray[tuple[int], dtype[single]]) – Cluster membership probabilities for all points, shape (n_samples,).

  • labels (ndarray[tuple[int], dtype[int_]]) – Dense cluster labels with shape (n_samples,).

Return type:

ndarray[tuple[int], dtype[int_]]

Returns:

medoid_indices – Integer array of shape (n_clusters,) with indices into the original point ordering.