# Edges and branches

Canonical URL: https://developers.iagenify.com/sdk/workflows/edges/
Language: en

The graph: one start, no cycles, nothing unreachable. Conditions, switches and merges each have shapes the definition insists on.

Status: one trigger edge · no cycles · branch names are checked

```javascript
edges: [
  { from: "__trigger", to: "classify" },
  { from: "classify", to: "check" },
  { from: "check", to: "urgent",  branch: "true" },
  { from: "check", to: "normal",  branch: "false" },
  { from: "urgent", to: "join" },
  { from: "normal", to: "join" },
]
```

| Name | Type | Requirement | Description |
| --- | --- | --- | --- |
| `from` | string | required | A step id, or `__trigger` for the start. |
| `to` | string | required | A step id. |
| `branch` | string | next | Which output. `true`/`false` on a condition, a case key or `default` on a switch. |

## The rules {#rules}

| Rule | Refusal |
| --- | --- |
| Exactly one edge from `__trigger` | the workflow must have one |
| No step connects to itself | a step cannot link to itself |
| No cycle anywhere | the graph contains a loop |
| Every step reachable from the trigger | unreachable steps, named |
| The trigger uses `next` only | the trigger uses only the next branch |

## Three types have required shapes {#shapes}

| Type | Must have |
| --- | --- |
| `condition` | exactly one `true` edge and one `false` edge |
| `switch` | one edge per case, plus `default` |
| `merge` | at least two incoming edges, and at most one `next` out |

> **Missing a branch is refused, not defaulted**
>
> A condition with only a true edge would end the run, without a word, whenever the answer was false. Requiring both means every path is a path somebody wrote.

## Parallel fan-out {#parallel}

Several edges from one step on the same branch run in parallel. A `merge` step is how they come back together — and it needs at least two inputs, since merging one thing is not merging.

## Without edges {#no-edges}

The order of `steps` is the chain: trigger to the first, each to the next. The simple case stays simple, and no graph is written for a straight line.

- [condition](/sdk/workflows/steps/condition): Two branches.
- [switch](/sdk/workflows/steps/switch): Several.
- [merge](/sdk/workflows/steps/merge): Bringing them back.

```python
edges = [
    {"from": "__trigger", "to": "classify"},
    {"from": "classify", "to": "check"},
    {"from": "check", "to": "urgent", "branch": "true"},
    {"from": "check", "to": "normal", "branch": "false"},
    {"from": "urgent", "to": "join"},
    {"from": "normal", "to": "join"},
]
```
