networkx 2.8.2 Pypi GitHub Homepage
Other Docs
NotesParametersRaisesReturnsBackRef
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.

Notes

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).

Parameters

G : NetworkX graph

Graph must be symmetric, connected, and without self-loops.

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.

weight : string or None, optional (default=None)

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.

Raises

NetworkXException

if the input graph is not connected.

NetworkXError

if the input graph contains self-loops.

Returns

non-randomness : (float, float) tuple

Non-randomness, Relative non-randomness w.r.t. Erdos Renyi random graphs.

Compute the non-randomness of graph G.

Examples

>>> G = nx.karate_club_graph()
... nr, nr_rd = nx.non_randomness(G, 2)
... nr, nr_rd = nx.non_randomness(G, 2, 'weight')
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

networkx.algorithms.non_randomness.non_randomness

Local connectivity graph

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


GitHub : /networkx/algorithms/non_randomness.py#11
type: <class 'function'>
Commit: