# grinpy.invariants.disparity.closed_k_disparity¶

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

Return the closed k-disparity of the graph.

The closed k-disparity of a graph is defined as:

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

where k is a positive integer and 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 closed k-disparity of the graph. float