Skip to main content

closure_indices

Function closure_indices 

Source
pub fn closure_indices(
    matrix: &dyn Matrix,
    seeds: &[usize],
    depth: usize,
) -> Vec<usize>
Expand description

Return the bounded-depth row-graph closure of seeds in matrix.

The output is sorted ascending and deduplicated, suitable as the candidates argument to crate::contrastive::find_anomalous_rows_in_subset.

  • depth = 0 returns the seed set itself (deduped + sorted).
  • depth = 1 returns seeds ∪ their direct row-graph neighbours.
  • Out-of-bound seed indices are silently dropped (they have no neighbours in matrix).

§Examples

let seeds = [3usize, 17];
let candidates = closure_indices(a, &seeds, 2);
// candidates ⊇ {3, 17} and every row reachable in ≤2 hops via A's
// non-zero pattern.