

def test_topological_sort2(self):
    DG = nx.DiGraph({
        1: [2],
        2: [3],
        3: [4],
        4: [5],
        5: [1],
        11: [12],
        12: [13],
        13: [14],
        14: [15],
    })
    assert_raises(nx.NetworkXUnfeasible, nx.topological_sort, DG)
    assert_raises(nx.NetworkXUnfeasible, nx.topological_sort_recursive, DG)
    assert_false(nx.is_directed_acyclic_graph(self))
    DG.remove_edge(1, 2)
    assert_equal(nx.topological_sort_recursive(DG), [11, 12, 13, 14, 15, 2, 3, 4, 5, 1])
    assert_equal(nx.topological_sort(DG), [11, 12, 13, 14, 15, 2, 3, 4, 5, 1])
    assert_true(nx.is_directed_acyclic_graph(DG))

dataset/ETHPy150Open gkno/gkno_launcher/src/networkx/algorithms/tests/test_dag.py TestDAG.test_topological_sort2/VarMisuse@116/149 `DG`->`self`