is_DAG

Contents

is_DAG#

graph_tool.structure.is_DAG(g)[git][source]#

Return True if the graph is a directed acyclic graph (DAG).

Parameters:
gGraph

Graph to be used.

See also

topological_sort

Topological ordering of a directed acyclic graph

transitive_reduction

Transitive reduction of a directed acyclic graph

feedback_arc_set

Edges whose removal leaves the graph acyclic

all_topological_sorts

All topological orderings

Notes

The time complexity is \(O(V + E)\).

References

Examples

>>> g = gt.random_graph(30, lambda: (3, 3))
>>> print(gt.is_DAG(g))
False
>>> tree = gt.minimum_spanning_tree(g)
>>> g.set_edge_filter(tree)
>>> print(gt.is_DAG(g))
True