grinpy.invariants.residue.k_residue(G, k)

Return the k-residue of G.

The k-residue of a graph G is defined as follows:


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

where f(i) is the frequency of i in the elmination sequence of the graph. The elimination sequence is the sequence of deletions made during the Havel Hakimi process together with the zeros obtained in the final step.

G : graph
A Networkx graph.
kResidue : float
The k-residue of G.

residue, havel_hakimi_process, elimination_sequence