def is_directed_acyclic_graph(G):
    if not G.is_directed():
        return False
    try:
        topological_sort(G)
        return True
    except nx.NetworkXUnfeasible:
        return False
Return True if the graph G is a directed acyclic graph (DAG) or 
dataset/ETHPy150Open gkno/gkno_launcher/src/networkx/algorithms/dag.py/is_directed_acyclic_graph