yog/flow/min_cut

Global minimum cut algorithms for undirected graphs.

This module finds the global minimum cut in an undirected weighted graph - the partition of nodes into two non-empty sets that minimizes the total weight of edges crossing between the sets.

Algorithm

AlgorithmFunctionComplexityBest For
Stoer-Wagnerglobal_min_cut/1O(V³)Dense undirected graphs

The Stoer-Wagner algorithm uses Maximum Adjacency Search (MAS) to iteratively identify minimum s-t cuts and contract nodes, similar to how Prim’s algorithm builds a minimum spanning tree but selecting by maximum edge weight.

Key Concepts

Comparison with s-t Min-Cut

For finding a cut between specific source and sink nodes, use max_flow instead:

Use Cases

References

Types

pub type MinCut {
  MinCut(weight: Int, group_a_size: Int, group_b_size: Int)
}

Constructors

  • MinCut(weight: Int, group_a_size: Int, group_b_size: Int)

Values

pub fn global_min_cut(in graph: model.Graph(n, Int)) -> MinCut

Finds the global minimum cut of an undirected weighted graph using the Stoer-Wagner algorithm.

Returns the minimum cut weight and the sizes of the two partitions.

Time Complexity: O(V³)

Example

let result = min_cut.global_min_cut(in: graph)
Search Document