NetworkX

Previous topic

networkx.edge_betweenness

Next topic

networkx.closeness_centrality

networkx.degree_centrality

degree_centrality(G, v=None)

Compute the degree centrality for nodes.

The degree centrality for a node v is the fraction of nodes it is connected to.

Parameters:

G : graph

A networkx graph

v : node, optional

Return only the value for node v.

Returns:

nodes : dictionary

Dictionary of nodes with degree centrality as the value.

Notes

The degree centrality is normalized to the maximum possible degree in the graph G. That is, G.degree(v)/(G.order()-1).