

def degree(self, nbunch=None, weight=None):
    'Return the degree of a node or nodes.\n\n        The node degree is the number of edges adjacent to that 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 degree as values or\n            a number if a single node is specified.\n\n        Examples\n        --------\n        >>> G = nx.Graph()   # or DiGraph, MultiGraph, MultiDiGraph, etc\n        >>> G.add_path([0,1,2,3])\n        >>> G.degree(0)\n        1\n        >>> G.degree([0,1])\n        {0: 1, 1: 2}\n        >>> list(G.degree([0,1]).values())\n        [1, 2]\n\n        '
    if (nbunch in self):
        return next(self.degree_iter(nbunch, weight))[1]
    else:
        return dict(self.degree_iter(nbunch, weight))

dataset/ETHPy150Open networkx/networkx/networkx/classes/tests/timingclasses.py TimingGraph.degree/original