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:



rac{2}{k(k+1)}sum_{i=0}^{k-i}(k-i)f(i)

where k is a positive integer and f(i) is the frequency of i in the disparity sequence.

G : graph
A Networkx graph.
kDisparity : float
The k-disparity of the graph.

closed_k_disparity