# `Nous.Decisions.Edge`
[🔗](https://github.com/nyo16/nous/blob/v0.17.1/lib/nous/decisions/edge.ex#L1)

A directed edge connecting two nodes in the decision graph.

Edges encode the relationships between decision nodes: which options
were chosen, what actions lead to which outcomes, and how decisions
supersede or depend on one another.

## Architecture

Edges are plain structs stored alongside nodes in a `Nous.Decisions.Store`
backend. Each edge has a typed relationship (`edge_type`) and connects
a source node (`from_id`) to a destination node (`to_id`).

## Quick Start

    edge = Nous.Decisions.Edge.new(%{
      from_id: goal_node.id,
      to_id: decision_node.id,
      edge_type: :leads_to
    })

## Fields

| Field | Type | Description |
|-------|------|-------------|
| `id` | `String.t()` | Unique identifier (auto-generated) |
| `from_id` | `String.t()` | Source node ID |
| `to_id` | `String.t()` | Destination node ID |
| `edge_type` | `edge_type()` | Relationship type |
| `metadata` | `map()` | Arbitrary key-value data |
| `created_at` | `DateTime.t()` | When the edge was created |

# `edge_type`

```elixir
@type edge_type() ::
  :leads_to | :chosen | :rejected | :requires | :blocks | :enables | :supersedes
```

# `t`

```elixir
@type t() :: %Nous.Decisions.Edge{
  created_at: DateTime.t(),
  edge_type: edge_type(),
  from_id: String.t(),
  id: String.t(),
  metadata: map(),
  to_id: String.t()
}
```

# `new`

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

Create a new edge with auto-generated ID and timestamp.

Required: `:from_id`, `:to_id`, and `:edge_type`.

## Examples

    iex> edge = Nous.Decisions.Edge.new(%{from_id: "a", to_id: "b", edge_type: :leads_to})
    iex> edge.edge_type
    :leads_to
    iex> is_binary(edge.id)
    true

---

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