Skip to main content
`Ctrl`+`K`

# is_directed_acyclic_graph

is_directed_acyclic_graph(G)

  Returns True if the graph `G` is a directed acyclic graph (DAG) or False if not.

  Parameters:
    G NetworkX graph
  Returns:
    bool

      True if `G` is a DAG, False otherwise

  See also

  `topological_sort`

  Examples

  Undirected graph:

      >>> G = nx.Graph([(1, 2), (2, 3)])
      >>> nx.is_directed_acyclic_graph(G)
      False

  Directed graph with cycle:

      >>> G = nx.DiGraph([(1, 2), (2, 3), (3, 1)])
      >>> nx.is_directed_acyclic_graph(G)
      False

  Directed acyclic graph:

      >>> G = nx.DiGraph([(1, 2), (2, 3)])
      >>> nx.is_directed_acyclic_graph(G)
      True