

def in_degree(self, nbunch=None, weight=None):
    'Return the in-degree of a node or nodes.\n\n        The node in-degree is the number of edges pointing in to the node.\n\n        Parameters\n        ----------\n        nbunch : iterable container, optional (default=all nodes)\n            A container of nodes.  The container will be iterated\n            through once.\n\n        weight : string or None, optional (default=None)\n           The edge attribute that holds the numerical value used\n           as a weight.  If None, then each edge has weight 1.\n           The degree is the sum of the edge weights adjacent to the node.\n\n        Returns\n        -------\n        nd : dictionary, or number\n            A dictionary with nodes as keys and in-degree as values or\n            a number if a single node is specified.\n\n        See Also\n        --------\n        degree, out_degree, in_degree_iter\n\n        Examples\n        --------\n        >>> G = nx.DiGraph()   # or MultiDiGraph\n        >>> G.add_path([0,1,2,3])\n        >>> G.in_degree(0)\n        0\n        >>> G.in_degree([0,1])\n        {0: 0, 1: 1}\n        >>> list(G.in_degree([0,1]).values())\n        [0, 1]\n        '
    if (nbunch in self):
        return next(self.in_degree_iter(nbunch, weight))[1]
    else:
        return dict(self.in_degree_iter(nbunch, weight))

dataset/ETHPy150Open networkx/networkx/networkx/classes/tests/timingclasses.py TimingDiGraph.in_degree/original