Letting N(h,p)=(h−1)⋅min(p,h/2+1), we now proceed to prove by induction on h that if the number of edges of a graph on hp vertices does not exceed N(h,p), then the graph is h-partite on p-element classes. The base case h=1 is clear.
Next, let h≥2 and let G=(V,E) be a graph on hp vertices which has at most N(h,p) edges. If necessary, add some extra edges to obtain ∣E∣=N(h,p).
Begin by forming a p-element house V0 of independent vertices v1,…,vp by the following p-step greedy algorithm: Start with the empty set, and at step j choose a vertex vj of maximal degree from the set of vertices joined by an edge to no vi, i<j, and different from any of these; this set is nonempty, for if each of the remaining hp−j+1 vertices were joined by an edge to some vi, i<j, then ∣E∣≥hp−j+1≥hp−p+1>N(h,p) — a contradiction. Notice that degv1≥degv2≥⋯≥degvp.
Let d=∑v∈V0degv, so the subgraph G′ induced by the p(h−1) vertices in V∖V0 has exactly N(h,p)−d edges. If d≥ΔN=N(h,p)−N(h−1,p), then G′ is (h−1)-partite on p-element classes by the induction hypothesis, and the conclusion follows.
Henceforth, assume
d<ΔN={p,h,if h≥2p−1,if h≤2p−2,(∗)
and notice that ΔN≤h in either case, so d≤h−1. Let V′ be the set of all vertices in V∖V0 joined by an edge to some vertex in V0, and notice that ∣V′∣≤d≤h−1, and degv≤degvp for all vertices v outside V0∪V′.
If degvp=0, then the vertices outside V0∪V′ are all isolated. Since ∣V′∣≤d≤h−1, each vertex of V′ may be included in a different p-element house (other than V0) along with p−1 vertices outside V0∪V′ each, to obtain ∣V′∣ more p-element houses. The remaining vertices, if any, are then arbitrarily split into p-element houses.
Finally, we rule out the case degvp≥1. Suppose, if possible, that degvp≥1. Then degvi≥1, i=1,…,p, and d≥p, so (*) yields ΔN=h, h≤2p−2, and N(h,p)=(h−1)(h+2)/2. Hence p≤d≤h−1≤2p−3. The inequality d≤2p−3 forces degvp=1, so degv≤1 for all vertices v outside V0∪V′, and
v∈V∖(V0∪V′)∑degv≤hp−∣V0∣=p(h−1).
Further on, split V′=V1∪⋯∪Vp, where Vj is the set of all vertices joined by an edge to vj, but to no vi, i<j. Notice that ∣Vi∣≤degvi, and degv≤degvi for all vertices v in Vi. Consequently,
v∈V0∪V′∑degv=i=1∑p(degvi+v∈Vi∑degv)≤i=1∑pdegvi(degvi+1)=i=1∑p(degvi−1)2+3d−p.
Since degvi≥1, i=1,…,p,
i=1∑p(degvi−1)2≤(i=1∑p(degvi−1))2=(d−p)2,
so (recalling that d≤h−1)
v∈V0∪V′∑degv≤(d−p)2+3d−p≤(h−p−1)2+3(h−1)−p=(h−1)(h+2)+p(p−2h+1)=2N(h,p)+p(p−2h+1).
Hence, by the preceding,
2N(h,p)=2∣E∣=v∈V∑degv=v∈V0∪V′∑degv+v∈V∖(V0∪V′)∑degv≤2N(h,p)+p(p−2h+1)+p(h−1)=2N(h,p)+p(p−h)<2N(h,p),
which is a contradiction. This ends the proof.