rich_club_coefficient#
- graph_tool.correlations.rich_club_coefficient(g, normalized=False, n_samples=10, n_iter=10)[git][source]#
Return the rich-club coefficient of an undirected graph.
- Parameters:
- g
Graph Undirected graph to be used.
- normalized
bool(optional, default:False) If
True, the coefficient is divided by its average over random graphs with the same degrees.- n_samples
int(optional, default:10) Number of random graphs for the normalization.
- n_iter
int(optional, default:10) Number of rewiring sweeps (over all edges) used to generate every random graph.
- g
- Returns:
- phi
numpy.ndarray The coefficient \(\phi(k)\) for \(k = 0, \dots, k_{\max} - 1\) (
nanwhere fewer than two vertices have degree larger than \(k\)).
- phi
See also
assortativityAssortativity coefficient
avg_neighbor_corrAverage nearest-neighbor correlation
graph_tool.generation.random_rewireDegree-preserving randomization
Notes
The rich-club coefficient [colizza-detecting-2006] is the density of the subgraph induced by the vertices of degree larger than \(k\),
\[\phi(k) = \frac{2E_{>k}}{N_{>k}(N_{>k}-1)},\]where \(N_{>k}\) is the number of vertices with degree larger than \(k\), and \(E_{>k}\) is the number of edges between them. Since it grows with \(k\) also in uncorrelated graphs, it is usually compared with its value \(\phi_\text{rand}(k)\) for random graphs with the same degree sequence, generated here with
random_rewire()(configuration model, without parallel edges or self-loops), giving \(\rho(k) = \phi(k)/\langle\phi_\text{rand}(k)\rangle\). Parallel edges and self-loops of the graph are counted as in its degrees. The coefficient is computed in time \(O(V + E)\).References
[colizza-detecting-2006]Vittoria Colizza, Alessandro Flammini, M. Ángeles Serrano and Alessandro Vespignani, “Detecting rich-club ordering in complex networks”, Nature Physics 2, 110-115 (2006), DOI: 10.1038/nphys209 [sci-hub, @tor], arXiv: physics/0602134
Examples
>>> g = gt.collection.data["netscience"] >>> rho = gt.rich_club_coefficient(g, normalized=True) >>> print(rho[[1, 5, 10, 20]]) [1.0384772... 1.6256781... 2.9773869... 7.5 ]