Skip to main content

maximum_spanning_forest

Function maximum_spanning_forest 

Source
pub fn maximum_spanning_forest<T>(
    graph: &CompressedSparseData2<T>,
) -> Result<CompressedSparseData2<T>, MethodsErrors>
Expand description

Maximum spanning forest of a CSR adjacency.

The same routine with the weight ordering flipped. Preferring the heaviest edges is what PAGA’s connectivities_tree wants, and it avoids the reference implementation’s detour through the reciprocals of the weights.

§Params

  • graph - Square CSR adjacency, read as undirected. Self loops and NaN weights are skipped; infinities are ordinary weights.

§Returns

A symmetric CSR of the same shape holding the retained edges at their original weights, or an error when graph is not a structurally sound square CSR.