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

Result of maximum flow computation (Edmonds-Karp, etc.).

Contains the maximum flow value and the residual graph, which can be used
to extract the minimum cut.

## Fields

- `max_flow` - The maximum flow value from source to sink
- `residual_graph` - The residual graph after flow computation
- `source` - The source node ID
- `sink` - The sink node ID
- `algorithm` - Name of the algorithm used (optional)
- `metadata` - Optional metadata (iterations, time, etc.)

## Examples

    iex> graph = Yog.directed() |> Yog.add_edge_ensure(from: 1, to: 2, with: 10)
    iex> result = %Yog.Flow.MaxFlowResult{
    ...>   max_flow: 15,
    ...>   residual_graph: graph,
    ...>   source: 1,
    ...>   sink: 4,
    ...>   algorithm: :edmonds_karp
    ...> }
    iex> result.max_flow
    15

# `t`

```elixir
@type t() :: %Yog.Flow.MaxFlowResult{
  algorithm: atom(),
  compare: (any(), any() -&gt; :lt | :eq | :gt),
  max_flow: number(),
  metadata: map(),
  residual_graph: Yog.graph(),
  sink: Yog.Model.node_id(),
  source: Yog.Model.node_id(),
  zero: any()
}
```

# `from_map`

```elixir
@spec from_map(map()) :: t()
```

Backward compatibility: convert from legacy map format.

# `new`

```elixir
@spec new(number(), Yog.graph(), Yog.Model.node_id(), Yog.Model.node_id()) :: t()
```

Creates a new max flow result.

# `new`

```elixir
@spec new(number(), Yog.graph(), Yog.Model.node_id(), Yog.Model.node_id(), atom()) ::
  t()
```

Creates a new max flow result with algorithm name.

# `new`

```elixir
@spec new(
  number(),
  Yog.graph(),
  Yog.Model.node_id(),
  Yog.Model.node_id(),
  atom(),
  any(),
  (any(), any() -&gt; :lt | :eq | :gt)
) :: t()
```

Creates a new max flow result with algorithm name, zero element, and comparison function.

# `residual_capacity`

```elixir
@spec residual_capacity(t(), Yog.Model.node_id(), Yog.Model.node_id()) :: number()
```

Get flow value on a specific edge in the residual graph.

# `to_map`

```elixir
@spec to_map(t()) :: map()
```

Convert to legacy map format.

---

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