extract_mutual_spanning_forest¶
- fast_plscan.extract_mutual_spanning_forest(graph, *, min_samples=5, is_sorted=False)¶
Computes a mutual spanning forest from a sparse CSR distance matrix.
- Parameters:
graph (
csr_array) – A sparse (square) distance matrix in CSR format. Each point must have at least min_samples neighbors, with no explicit self-loops. The function is most efficient when the matrix is explicitly symmetric.min_samples (
int, default:5) – Core distances are the distance to the min_samples-th nearest neighbor.is_sorted (
bool, default:False) – If True, the input graph rows are assumed to be sorted by distance.
- Return type:
tuple[SpanningTree,SparseGraph,ndarray[tuple[int],dtype[single]]]- Returns:
spanning_forest – A spanning forest of the input sparse distance matrix. If the input data forms a single connected component, the spanning forest is a minimum spanning tree. Otherwise, it is a collection of minimum spanning trees, one for each connected component.
graph – A copy of the input graph with edges weighted and sorted by mutual reachability.
core_distances – A 1D array with core distances.