Skip to main content

spanning_tree_iterator

Function spanning_tree_iterator 

Source
pub fn spanning_tree_iterator(
    graph: &Graph,
    weight_attr: &str,
    max_count: usize,
) -> Vec<Graph>
Expand description

Enumerate spanning trees in weight-sorted order using the Janssens-Sörensen partition scheme.

Uses a priority queue of edge partitions (included/excluded/open). For each partition, runs partition_spanning_tree to find the MST respecting partition constraints. New partitions are generated by excluding/including open edges from the current tree. This matches NetworkX SpanningTreeIterator behavior.

§Arguments

  • graph — undirected graph
  • weight_attr — edge attribute for weight (default “weight”)
  • max_count — maximum number of trees to return