# `Yog.MST.Result`
[🔗](https://github.com/code-shoily/yog_ex/blob/v0.97.0/lib/yog/mst/result.ex#L1)

Result of a Minimum Spanning Tree computation.

Contains the edges of the MST along with summary statistics.

## Fields

- `edges` - List of edges in the MST, as `%{from: id, to: id, weight: term()}` maps
- `total_weight` - Sum of all edge weights in the MST
- `node_count` - Number of nodes in the original graph
- `edge_count` - Number of edges in the MST
- `algorithm` - The algorithm used (`:kruskal`, `:prim`, `:boruvka`, `:chu_liu_edmonds`, or `:wilson`)
- `root` - The root node ID (for arborescence algorithms)

## Examples

    iex> edges = [
    ...>   %{from: 1, to: 2, weight: 1},
    ...>   %{from: 2, to: 3, weight: 2}
    ...> ]
    iex> result = Yog.MST.Result.new(edges, :kruskal, 3)
    iex> result.total_weight
    3
    iex> result.edge_count
    2

# `t`

```elixir
@type t() :: %Yog.MST.Result{
  algorithm: :kruskal | :prim | :boruvka | :chu_liu_edmonds | :wilson,
  edge_count: non_neg_integer(),
  edges: [Yog.MST.edge()],
  node_count: non_neg_integer(),
  root: Yog.node_id() | nil,
  total_weight: number()
}
```

# `new`

```elixir
@spec new(
  [Yog.MST.edge()],
  :kruskal | :prim | :boruvka | :chu_liu_edmonds | :wilson,
  non_neg_integer(),
  term()
) :: t()
```

Creates a new MST result from a list of edges.

## Example

    iex> edges = [%{from: 1, to: 2, weight: 5}]
    iex> Yog.MST.Result.new(edges, :prim, 2)
    %Yog.MST.Result{
      edges: [%{from: 1, to: 2, weight: 5}],
      total_weight: 5,
      node_count: 2,
      edge_count: 1,
      algorithm: :prim
    }

---

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