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

Return the k-disparity of the graph.

The k-disparity of a graph is defined as:


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.
Returns:The k-disparity of the graph.
Return type:float