Skip to main content

minimum_cycle_basis

Function minimum_cycle_basis 

Source
pub fn minimum_cycle_basis(
    graph: &Graph,
    weight_attr: Option<&str>,
) -> Result<CycleBasisResult, MinimumCycleBasisError>
Expand description

Compute a minimum weight cycle basis for a FrankenNetworkX undirected graph.

This wrapper performs graph-specific wiring: it preserves node insertion order as the stable index order, extracts optional edge weights with NetworkX’s missing-weight default of 1.0, and maps indexed core cycles back to node-name cycles.

§Errors

Returns MinimumCycleBasisError::NegativeWeight when an extracted edge weight is negative. The core uses Dijkstra over the lifted graph, matching NetworkX’s non-negative weighted shortest-path requirement.