import networkx as nx def descendents(g, nom): return set(nx.dfs_predecessors(g, nom))