non_randomness(G, k=None, weight='weight')
The first returned value nr is the sum of non-randomness values of all edges within the graph (where the non-randomness 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.
This computes Eq. (4.4) and (4.5) in Ref. .
If a weight field is passed, this algorithm will use the eigenvalues of the weighted adjacency matrix to compute Eq. (4.4) and (4.5).
Graph must be symmetric, connected, and without self-loops.
The number of communities in G. If k is not set, the function will use a default community detection algorithm to set it.
The name of an edge attribute that holds the numerical value used as a weight. If None, then each edge has weight 1, i.e., the graph is binary.
if the input graph is not connected.
if the input graph contains self-loops.
Non-randomness, Relative non-randomness w.r.t. Erdos Renyi random graphs.
Compute the non-randomness of graph G.
>>> G = nx.karate_club_graph()See :
... nr, nr_rd = nx.non_randomness(G, 2)
... nr, nr_rd = nx.non_randomness(G, 2, 'weight')
The following pages refer to to this document either explicitly or contain code examples using this.
networkx.algorithms.non_randomness.non_randomness
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them