# `AshWorkflow.Charts.Graph`
[🔗](https://github.com/team-alembic/ash_workflow/blob/v0.12.0/lib/ash_workflow/charts/graph.ex#L1)

The diagram model every `AshWorkflow.Charts` backend draws from.

A graph is a list of `AshWorkflow.Charts.Graph.Node` and a list of
`AshWorkflow.Charts.Graph.Edge`, with every label already written out. A
backend only maps each node kind and edge kind to its own syntax, so every
format shows the same workflow in the same words. `build/2` makes a graph.

# `t`

```elixir
@type t() :: %AshWorkflow.Charts.Graph{
  edges: [AshWorkflow.Charts.Graph.Edge.t()],
  nodes: [AshWorkflow.Charts.Graph.Node.t()],
  resource: Ash.Resource.t()
}
```

# `build`

```elixir
@spec build(Ash.Resource.t(), keyword()) :: t()
```

Builds the diagram model for a resource that uses `AshWorkflow`.

It reads `AshWorkflow.Info.workflow_graph/1` and
`AshWorkflow.Info.undoable_edges/1` once. Nodes are in step declaration
order. Edges are grouped by the step they leave, in declaration order, and
undo edges come last. Within one step the order is `on_success` routes,
transitions, `on_signal` handlers and timeouts that move the record, then
`on_error`.

Raises `ArgumentError` for a module that is not such a resource.

## Options

* `:undo` — include an edge for each move the generated `undo` action can
  rewind. Defaults to `true`. Has no effect on a workflow without an `undo`
  block.
* `:notes` — include each step's notes. Defaults to `true`.

---

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