# 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`


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mazze.io/architecture/dag-and-dets.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
