# Directed Acyclic Graph (DAG)

> A graph of one-way arrows with no loops. It shows what must come first.

**Field:** Software Development  
**Category:** Algorithms & Data Structures  
**Also known as:** DAG, Acyclic Graph, Directed Acyclic Graphs

## Think of it like

Think of it like a family tree. Arrows go from mums and dads to kids, and never back up.

## Definition

A directed acyclic graph is a graph where every link points one way and no path loops back. Directed means each edge has an arrow. Acyclic means you can never follow the arrows back to where you began. That makes it perfect for steps that must happen in order. Task runners, build tools and Git history all use one.

## Example

A data job has five steps. Get data comes first, then clean data, then two reports, then one email. That plan is a DAG.

## Why it matters

With no loops, a program can always find a safe order to run the steps in.

## Common mistake

Adding a step that depends on a later step. That makes a loop, and the plan can never finish.

## Three principles

- **One-way arrows.** Each edge points from first to next.
- **No loops.** You never come back to the start.
- **Gives an order.** There is always a safe order to run.

## Related terms

- [Graph (Data Structure)](https://learn.benibix.com/term/development/graph)
- [Tree (Data Structure)](https://learn.benibix.com/term/development/tree)
- [Depth-First Search (DFS)](https://learn.benibix.com/term/development/depth-first-search)
- [Airflow DAG](https://learn.benibix.com/term/data/airflow-dag)
- [Workflow Orchestration](https://learn.benibix.com/term/data/workflow-orchestration)

## Told apart from

- [DAG vs Tree](https://learn.benibix.com/compare/directed-acyclic-graph-vs-tree): A tree gives every node just one parent, but a DAG lets a step wait on two or more steps. Both have no loops. Only the DAG can join paths back together.

![Five boxes joined by one-way arrows: get data leads to clean data, clean data leads to both make chart and build report, and both of those lead to send email. Every arrow points forward. On the right, a small crossed-out loop shows that an arrow back to an earlier box is not allowed.](https://learn.benibix.com/diagrams/dev3-dag.svg)

---

Source: https://learn.benibix.com/term/development/directed-acyclic-graph
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-19
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
