- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# Directed Acyclic Graph (DAG)

## Definition

In computer science and mathematics, a directed acyclic graph (DAG) refers to a directed graph which has no directed cycles.

## Explanation

In graph theory, a graph refers to a set of vertices which are connected by lines called edges. In a directed graph or a digraph, each edge is associated with a direction from a start vertex to an end vertex. If we traverse along the direction of the edges and we find that no closed loops are formed along any path, we say that there are no directed cycles. The graph formed is a directed acyclic graph.

A DAG is always topologically ordered, i.e. for each edge in the graph, the start vertex of the edge occurs earlier in the sequence than the ending vertex of the edge.

## Example

In the above directed graph, if we find the paths from any node, say u, we will never find a path that come back to u. Hence, this is a DAG.

## Application Areas

Some of the main application areas of DAG are −

Routing in computer networks

Job scheduling

Data processing

Genealogy

Citation graphs

- Related Questions & Answers
- Longest Path in a Directed Acyclic Graph
- Shortest Path in a Directed Acyclic Graph
- C++ Program to Find SSSP (Single Source Shortest Path) in DAG (Directed Acyclic Graphs)
- Tree or Connected acyclic graph
- C++ Program to Apply DFS to Perform the Topological Sorting of a Directed Acyclic Graph
- C++ Program to Generate a Random Directed Acyclic Graph DAC for a Given Number of Edges
- Connectivity in a directed graph
- C++ Program to Check Whether Graph is DAG
- Detect Cycle in a Directed Graph
- Euler Circuit in a Directed Graph
- Program to reverse the directed graph in Python
- Python Program for Detect Cycle in a Directed Graph
- C++ Program to Check the Connectivity of Directed Graph Using DFS
- C++ Program to Check the Connectivity of Directed Graph Using BFS
- Check if a given directed graph is strongly connected in C++