Skip to main content

validate_square_csr

Function validate_square_csr 

Source
pub fn validate_square_csr<T>(
    graph: &CompressedSparseData2<T>,
) -> Result<usize, SparseErrors>
where T: Clone,
Expand description

Check that a matrix is a structurally sound square CSR and return its order

Callers that index partitions[j] or parent[j] from a stored column index rely on every invariant here, and a violated one is otherwise silent: a non-monotonic indptr gives an empty Rust range, so the row is skipped and the caller returns a plausible answer computed on a subset of the graph. An out-of-range column index panics through whatever boundary the caller sits behind instead of erroring.

§Params

  • graph - The adjacency to validate.

§Returns

The node count, or an error naming the violated invariant.