@not_implemented_for('undirected')
def in_degree_centrality(G):
 centrality = {}
 s = (1.0 / (len(G) - 1.0))
 centrality = {n: (d * s) for (n, d) in G.in_degree()}
 return centrality

@ not_implemented_for ( 'undirected' ) def in_degree_centrality ( G ) : centrality = { } s = ( 1.0 / ( len ( G ) - 1.0 ) ) centrality = { n : ( d * s ) for ( n , d ) in G . in_degree ( ) } return centrality
compute the in-degree centrality for nodes .