Result of minimum cut computation.
A cut partitions the nodes into two sets: the source side and the sink side. The cut value equals the total weight of edges crossing between the sets.
Fields
cut_value- Total weight of the minimum cutsource_side_size- Number of nodes in the source partitionsink_side_size- Number of nodes in the sink partitionsource_side- OptionalMapSetof node IDs in the source partitionsink_side- OptionalMapSetof node IDs in the sink partitionalgorithm- Name of the algorithm used (optional)
Examples
iex> result = %Yog.Flow.MinCutResult{
...> cut_value: 15,
...> source_side_size: 2,
...> sink_side_size: 3
...> }
iex> result.source_side_size + result.sink_side_size
5Backward Compatibility
The source_side and sink_side fields are populated when using
global_min_cut/2 with track_partitions: true or when extracting
a min-cut from a max-flow result.
Summary
Functions
Creates a new min cut result.
Creates a new min cut result with explicit partitions.
Computes the product of partition sizes.
Returns the total number of nodes in the graph.
Types
@type t() :: %Yog.Flow.MinCutResult{ algorithm: atom(), cut_value: number(), sink_side: MapSet.t(Yog.node_id()) | nil, sink_side_size: non_neg_integer(), source_side: MapSet.t(Yog.node_id()) | nil, source_side_size: non_neg_integer() }
Functions
@spec new(number(), non_neg_integer(), non_neg_integer()) :: t()
Creates a new min cut result.
Examples
iex> Yog.Flow.MinCutResult.new(10, 3, 4)
%Yog.Flow.MinCutResult{
cut_value: 10,
source_side_size: 3,
sink_side_size: 4,
algorithm: :stoer_wagner
}
@spec new( number(), non_neg_integer(), non_neg_integer(), MapSet.t(Yog.node_id()) | nil, MapSet.t(Yog.node_id()) | nil ) :: t()
Creates a new min cut result with explicit partitions.
@spec partition_product(t()) :: non_neg_integer()
Computes the product of partition sizes.
Examples
iex> result = Yog.Flow.MinCutResult.new(10, 3, 4)
iex> Yog.Flow.MinCutResult.partition_product(result)
12
@spec total_nodes(t()) :: non_neg_integer()
Returns the total number of nodes in the graph.
Examples
iex> result = Yog.Flow.MinCutResult.new(10, 3, 4)
iex> Yog.Flow.MinCutResult.total_nodes(result)
7