@not_implemented_for('directed')
@not_implemented_for('multigraph')
def rich_club_coefficient(G, normalized=True, Q=100):
 if (G.number_of_selfloops() > 0):
  raise Exception('rich_club_coefficient is not implemented for graphs with self loops.')
 rc = _compute_rc(G)
 if normalized:
  R = G.copy(with_data=False)
  E = R.number_of_edges()
  nx.double_edge_swap(R, (Q * E), max_tries=((Q * E) * 10))
  rcran = _compute_rc(R)
  rc = {k: (v / rcran[k]) for (k, v) in rc.items()}
 return rc

@ not_implemented_for ( 'directed' ) @ not_implemented_for ( 'multigraph' ) def rich_club_coefficient ( G , normalized = True , Q = 100 ) : if ( G . number_of_selfloops ( ) > 0 ) : raise Exception ( 'rich_club_coefficient is not implemented for graphs with self loops.' ) rc = _compute_rc ( G ) if normalized : R = G . copy ( with_data = False ) E = R . number_of_edges ( ) nx . double_edge_swap ( R , ( Q * E ) , max_tries = ( ( Q * E ) * 10 ) ) rcran = _compute_rc ( R ) rc = { k : ( v / rcran [ k ] ) for ( k , v ) in rc . items ( ) } return rc
returns the rich-club coefficient of the graph g .