def get_input_nodes ( G : nx . DiGraph ) -> List [ str ] : return [ n for n , d in G . in_degree ( ) if d == 0 ]
python networkx graph filter degree
Get all input nodes from a network .
def get_input_nodes(G: nx.DiGraph) -> List[str]:
    """ Get all input nodes from a network. """
    return [n for n, d in G.in_degree() if d == 0]