

def test_descendants(self):
    G = nx.DiGraph()
    descendants = nx.algorithms.dag.descendants
    G.add_edges_from([(1, 2), (1, 3), (4, 2), (4, 3), (4, 5), (2, 6), (5, 6)])
    assert_equal(descendants(G, 1), set([2, 3, 6]))
    assert_equal(descendants(G, 4), set([2, 3, 5, 6]))
    assert_equal(descendants(G, 3), set())
    assert_raises(nx.NetworkXError, descendants, G, 8)

dataset/ETHPy150Open gkno/gkno_launcher/src/networkx/algorithms/tests/test_dag.py TestDAG.test_descendants/original