# `MixAffected.Graph.Source`
[🔗](https://github.com/mnox/mix_affected/blob/v0.1.0/lib/mix_affected/graph/source.ex#L1)

Behaviour for producing a project's raw file dependency graph.

An adapter returns `t:MixAffected.Graph.adjacency/0` with paths exactly as
the toolchain reports them (relative to the project, or to the owning child
app at an umbrella root); `MixAffected.Graph.build/2` resolves them to
root-relative paths. An adapter must never answer `{:ok, graph}` with a
graph it could not fully read: any doubt is `{:error, reason}`.

Adapters:

  * `MixAffected.Graph.Source.XrefJson` - `mix xref graph --format json`,
    Elixir >= 1.19
  * `MixAffected.Graph.Source.XrefDot` - `mix xref graph --format dot`, the
    path for Elixir 1.18 (dot edges carry `(compile)` / `(export)` labels,
    runtime edges are unlabelled)

# `fetch`

```elixir
@callback fetch(root :: Path.t(), opts :: keyword()) ::
  {:ok, MixAffected.Graph.adjacency()} | {:error, MixAffected.Graph.error()}
```

Reads the dependency graph of the compiled project at the absolute path
`root`. Receives the options given to `MixAffected.Graph.build/2`.

# `default`

```elixir
@spec default(String.t()) :: module()
```

The adapter for Elixir `version`: `XrefJson` from 1.19.0 on, `XrefDot`
before (pre-releases of 1.19 included, since JSON output only shipped in
the final release).

---

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