# grinpy.invariants.disparity.k_disparity¶

grinpy.invariants.disparity.k_disparity(G, k)

Return the k-disparity of the graph.

The k-disparity of a graph is defined as:

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

where k is a positive integer and d_i is the i-th element in the disparity sequence, ordered in weakly decreasing order.

Parameters: G (NetworkX graph) – An undirected graph. The k-disparity of the graph. float