> For the complete documentation index, see [llms.txt](https://docs.mazze.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mazze.io/architecture/dag-and-dets.md).

# DAG and DETS

Mazze blocks form a DAG, not a single chain. Each block has a parent edge and zero or more referee edges. The consensus layer treats this as a DAG-Embedded Tree Structure (DETS).

## Graph primitives

The `dag` crate defines core traits:

* `Graph` - nodes with an index.
* `DAG` - predecessor edges and topological order.
* `DETS` - tree parent plus referee edges.
* `RichDAG` / `RichDETS` - forward edges for traversals.

`DETS` is the key abstraction used by sync and consensus.

## Parent and referee edges

* Parent edge: ensures a tree backbone and supports chain-like operations.
* Referee edges: link side blocks to expand the past set and increase throughput while preserving ordering.

## DAG tips and future sets

* Tips are terminal blocks with no children.
* `get_future` and `topological_sort` help build ordered subsets of the DAG, especially when computing outlier sets or epoch block ordering.

## Where DETS is implemented

* `SynchronizationGraphInner` implements DETS for all received blocks.
* `ConsensusGraphInner` implements DETS for validated, ready blocks.

## Key source files

* `crates/util/dag/src/lib.rs`
* `crates/mazzecore/core/src/sync/synchronization_graph.rs`
* `crates/mazzecore/core/src/consensus/consensus_inner/mod.rs`
