# grinpy.invariants.disparity.irregularity¶

grinpy.invariants.disparity.irregularity(G)

Return the irregularity measure of the graph.

The irregularity of an n-vertex graph is defined as:

$\frac{2}{n(n+1)}\sum_{i=0}^{n-i}(n-i)d_i$

where d_i is the i-th element in the closed disparity sequence, ordered in weakly decreasing order.

Parameters: G (NetworkX graph) – An undirected graph. The irregularity of the graph. float