Documentation

FormalConjecturesForMathlib.Combinatorics.SimpleGraph.Residue

Residue #

The residue of a graph is the number of zeros remaining after iteratively applying the Havel-Hakimi algorithm to the degree sequence until all remaining degrees are zero.

Helper function: Performs one step of the Havel-Hakimi reduction on a degree sequence. Assumes the input list s is sorted descending. Removes the first element d, decrements the next d elements by 1, and re-sorts the list descending.

Note: when s is the list of vertices arising from a simple graph, if the first index is s then the degree list always has length at least s+1 so this makes sense.

Equations
Instances For

    havelHakimiStep drops the list length by exactly one on a nonempty list: (havelHakimiStep (d :: rest)).length = rest.length. splitAt partitions rest, and map, ++, and mergeSort all preserve the total length while the head d is dropped. This is the termination measure for the well-founded residueAux below.

    @[irreducible]

    Auxiliary function to calculate the residue recursively. Applies Havel-Hakimi steps until the sequence consists only of zeros or is empty. Defined by well-founded recursion on the list length (via havelHakimiStep_length_cons), so that it admits equational and inductive reasoning.

    Equations
    Instances For
      noncomputable def SimpleGraph.residue {α : Type u_1} [Fintype α] (G : SimpleGraph α) [DecidableRel G.Adj] :

      Computes the residue of a graph G, i.e. the number of zeros remaining after iteratively applying the Havel-Hakimi algorithm to the degree sequence until all remaining degrees are zero. Starts with the descending degree sequence and applies the Havel-Hakimi process.

      Equations
      Instances For