# `Yog.Flow.MinCutResult`
[🔗](https://github.com/code-shoily/yog_ex/blob/v0.97.0/lib/yog/flow/min_cut_result.ex#L1)

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 cut
- `source_side_size` - Number of nodes in the source partition
- `sink_side_size` - Number of nodes in the sink partition
- `source_side` - Optional `MapSet` of node IDs in the source partition
- `sink_side` - Optional `MapSet` of node IDs in the sink partition
- `algorithm` - 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
    5

## Backward 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.

# `t`

```elixir
@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()
}
```

# `new`

```elixir
@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
    }

# `new`

```elixir
@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.

# `partition_product`

```elixir
@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

# `total_nodes`

```elixir
@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

---

*Consult [api-reference.md](api-reference.md) for complete listing*
