networkx.algorithms.non_randomness.non_randomness¶

non_randomness
(G, k=None)[source]¶ Compute the nonrandomness of graph G.
The first returned value nr is the sum of nonrandomness values of all edges within the graph (where the nonrandomness of an edge tends to be small when the two nodes linked by that edge are from two different communities).
The second computed value nr_rd is a relative measure that indicates to what extent graph G is different from random graphs in terms of probability. When it is close to 0, the graph tends to be more likely generated by an Erdos Renyi model.
 Parameters
G (NetworkX graph) – Graph must be binary, symmetric, connected, and without selfloops.
k (int) – The number of communities in G. If k is not set, the function will use a default community detection algorithm to set it.
 Returns
nonrandomness – Nonrandomness, Relative nonrandomness w.r.t. Erdos Renyi random graphs.
 Return type
Examples
>>> G = nx.karate_club_graph() >>> nr, nr_rd = nx.non_randomness(G, 2)
Notes
This computes Eq. (4.4) and (4.5) in Ref. 1.
References
 1
Xiaowei Ying and Xintao Wu, On Randomness Measures for Social Networks, SIAM International Conference on Data Mining. 2009