is_DAG

Contents

is_DAG#

graph_tool.topology.is_DAG(g)[source]#

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

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.min_spanning_tree(g)
>>> g.set_edge_filter(tree)
>>> print(gt.is_DAG(g))
True