is_DAG#
- graph_tool.structure.is_DAG(g)[git][source]#
Return
Trueif the graph is a directed acyclic graph (DAG).- Parameters:
- g
Graph Graph to be used.
- g
See also
topological_sortTopological ordering of a directed acyclic graph
transitive_reductionTransitive reduction of a directed acyclic graph
feedback_arc_setEdges whose removal leaves the graph acyclic
all_topological_sortsAll 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