Result of minimum cut computation.
A cut partitions the nodes into two sets: the source side (reachable from source) and the sink side (the rest). The cut value equals the total capacity of edges crossing from source side to sink side.
Fields
source_side- Set of nodes reachable from source in residual graphsink_side- Set of nodes on the sink side of the cutcut_value- Total capacity of the cut (optional, can be computed from max flow)cut_edges- List of edges in the cut (optional)algorithm- Name of the algorithm used (optional)metadata- Optional metadata
Examples
iex> result = %Yog.Flow.MinCutResult{
...> source_side: MapSet.new([1, 2]),
...> sink_side: MapSet.new([3, 4]),
...> cut_value: 15
...> }
iex> MapSet.size(result.source_side)
2
Summary
Functions
Compute the cut value from a graph and the partition.
Extract the edges that cross the cut.
Backward compatibility: convert from legacy map format.
Check if a node is in the sink partition.
Check if a node is in the source partition.
Creates a new min cut result.
Creates a new min cut result with cut value.
Convert to legacy map format.
Types
@type t() :: %Yog.Flow.MinCutResult{ algorithm: atom(), cut_edges: [{Yog.Model.node_id(), Yog.Model.node_id()}], cut_value: number() | nil, metadata: map(), sink_side: MapSet.t(Yog.Model.node_id()), source_side: MapSet.t(Yog.Model.node_id()) }
Functions
Compute the cut value from a graph and the partition.
Sums the capacities of edges going from source side to sink side.
@spec extract_cut_edges(t(), Yog.graph()) :: [ {Yog.Model.node_id(), Yog.Model.node_id()} ]
Extract the edges that cross the cut.
Returns list of {source_node, sink_node} pairs.
Backward compatibility: convert from legacy map format.
@spec in_sink?(t(), Yog.Model.node_id()) :: boolean()
Check if a node is in the sink partition.
@spec in_source?(t(), Yog.Model.node_id()) :: boolean()
Check if a node is in the source partition.
@spec new(MapSet.t(Yog.Model.node_id()), MapSet.t(Yog.Model.node_id())) :: t()
Creates a new min cut result.
@spec new(MapSet.t(Yog.Model.node_id()), MapSet.t(Yog.Model.node_id()), number()) :: t()
Creates a new min cut result with cut value.
Convert to legacy map format.