The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
A DAG is a directed acyclic graph: a set of nodes joined by arrows, with no path that follows the arrows and returns to its starting node. Because it has no directed cycles, its nodes can be arranged in an order that respects every arrow. That makes DAGs useful for representing dependencies, such as tasks that must be completed before other tasks begin.
What “directed” and “acyclic” mean
A graph consists of nodes (also called vertices) and edges connecting them. In a directed graph, each edge has an orientation, shown as an arrow. “Acyclic” means that following the arrows cannot bring you back to the node where you started. NIST defines a DAG as “a directed graph with no path that starts and ends at the same vertex.” NIST’s definition of a DAG
| # | Preview | Product | Price | |
|---|---|---|---|---|
| 1 |
|
Introduction to Graph Theory (Dover Books on Mathematics) | $15.09 | Buy on Amazon |
| 2 |
|
Graph Theory (Graduate Texts in Mathematics, 173) | $45.75 | Buy on Amazon |
| 3 |
|
A First Course in Graph Theory (Dover Books on Mathematics) | $24.41 | Buy on Amazon |
| 4 |
|
Basic Graph Theory | $40.00 | Buy on Amazon |
| 5 |
|
The Fascinating World of Graph Theory | $15.97 | Buy on Amazon |
For example, if the nodes are tasks and an arrow means “must finish before,” then A → C says task A must finish before task C. The meaning of an arrow depends on the model: a DAG describes relationships, but does not by itself prove that one event causes another.
Recommended Free Tools
How a topological order works
A topological order is a sequence of the graph’s nodes in which each node comes before every node it points to. Formally, for every edge (u, v), u must appear before v. A DAG always has at least one such ordering. LEDA’s guide to topological sorting
#1 Best Overall
For a dependency graph, read a topological order as one valid way to arrange the work so prerequisites come first. It is an ordering that obeys the arrows, not necessarily the only possible schedule.
Example: tasks with shared prerequisites
Suppose tasks A and B must both be completed before C, represented by A → C and B → C. A and B may be done in either order because neither points to the other. Both of these orders respect the dependencies:
Rank #2
A, B, CB, A, C
If the graph also includes C → D, then D must come after C. DAGs are used to model these kinds of dependency relationships, and topological sorting can produce an order that respects them. Neo4j’s DAG algorithms overview
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problemsWhy a cycle matters
A directed cycle makes a complete topological order impossible: each node in the cycle would have to appear before the next, while the final arrow would require the sequence to return to an earlier node. In a task model, that usually means the stated prerequisites conflict—for instance, one task depends on another that ultimately depends back on the first.
Some software may return only part of an ordering when cycles are present. Neo4j documents that its topological-sort result omits nodes in cycles and nodes that depend on those cycles, so a partial result should not be treated as a complete schedule. Neo4j’s topological-sort documentation
Quick Recap
Best Value
Rank #4
What to remember
- DAG means directed acyclic graph: arrows have direction, and no directed path loops back to its starting node.
- Every DAG has at least one topological order, in which each arrow points from an earlier node to a later one.
- Independent nodes can appear in different orders, so valid topological orders are not always unique. NetworkX’s DAG reference includes a generator for topological sorts. NetworkX DAG reference
- A directed cycle prevents a complete topological ordering and can reveal contradictory dependencies.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

