Return the degree of a node or nodes.
The node degree is the number of edges adjacent to that node.
Parameters: | nbunch : list, iterable
with_labels : False|True
weighted : False|True
|
---|
Examples
>>> G=nx.path_graph(4)
>>> G.degree(0)
1
>>> G.degree([0,1])
[1, 2]
>>> G.degree([0,1],with_labels=True)
{0: 1, 1: 2}