Degree Sequences and Realizability
Suppose someone hands you a list of numbers, say . They claim it is the list of degrees of some simple graph on seven vertices. Can you always find such a graph? If not, how would you know? This is the question of realizability of degree sequences. It turns out to have a clean, checkable answer rather than requiring exhaustive search. The problem matters because degree sequences are the simplest structural fingerprint of a graph. They are easy to write down and easy to compare. They appear whenever we need to build a network with prescribed connectivity requirements. Examples include designing communication topologies, modeling social networks, or chemical bonding patterns. The central insight is due independently to Havel and Hakimi and to Erdős and Gallai. Realizability can be decided by a finite, purely arithmetic test. There is no need to search over all graphs. The Havel–Hakimi approach gives a recursive construction. Greedily connect the highest-degree vertex to the next-highest-degree vertices, and reduce to a smaller problem. The Erdős–Gallai approach gives a direct inequality test. It uses a finite system of inequalities on partial sums of the sequence. This test is verifiable in polynomial time, with no reference to any actual graph. This article develops both characterizations rigorously. It proves their equivalence, and works through nontrivial examples where naive guessing fails. We build on the Handshake Lemma, which gives the necessary parity condition. From there, we isolate exactly what more is needed. A sequence of nonnegative integers must satisfy this to be the degree sequence of a genuine simple graph. This is a foundational topic in Graph Theory. The same recursive idea of stripping off a vertex and reducing to a smaller instance reappears elsewhere. We see it again when we study Trees and Their Properties, where degree sequences of trees have an especially elegant characterization. By the end, you will be able to test any finite sequence of nonnegative integers for graphicality. You can do this by hand or by a short algorithm. You will be able to construct an explicit realizing graph when one exists. You will also be able to explain precisely why each hypothesis in the theorems cannot be dropped. These hypotheses are simplicity, nonnegativity, and monotonicity of listing.
- A sequence is graphic if it is the degree sequence of some simple, undirected graph.
- The Handshake Lemma gives a necessary condition (even sum) but this is far from sufficient.
- Havel–Hakimi: sort descending, connect the top vertex to the next vertices, delete it, and recurse — the original sequence is graphic iff the reduced one is.
- Erdős–Gallai: a sorted sequence is graphic iff, for every , the sum of the top terms is bounded by plus the sum of over the rest.
- Both tests are equivalent and run in polynomial time, unlike brute-force search over all graphs on vertices.
- Key idea: realizability of a degree sequence is decidable by finitely many arithmetic checks, and a witnessing graph can be built greedily, vertex by vertex.
Where this lives today
Degree-sequence realizability underpins the configuration model in network science, where researchers generate random graphs with a target degree distribution to model social networks, the internet's router topology, or protein interaction networks; Havel–Hakimi-style stub-matching is the algorithmic backbone of that construction. In chemistry, realizability constraints analogous to these appear when checking whether a proposed valence sequence can correspond to an actual molecular graph. In statistics, the Erdős–Gallai inequalities inform tests for whether an observed degree sequence from sampled network data is even structurally possible, flagging data-collection errors. In operations research and scheduling, degree-sequence feasibility corresponds to questions like whether a round-robin tournament with prescribed numbers of games per team can be scheduled. The same reduction technique — strip the extremal object, recurse on a smaller instance — is a template you will see again when studying Trees and Their Properties, where the degree sequence of a tree satisfies its own clean characterization ( together with graphicality), and in the study of Bipartite Graphs, where the analogous Gale–Ryser theorem characterizes bidegree sequences.
Ask the tutor: Can you show me step by step why the Erdős–Gallai inequality at is exactly the condition that fails for , and how that connects to
Let be a finite sequence of nonnegative integers. We say is graphic if there exists a simple graph (no loops, no multiple edges) with vertex set such that for every . Such a is called a realization of . We typically arrange in weakly decreasing order,
since realizability does not depend on the order in which the terms are listed (relabeling vertices permutes the sequence without changing whether a realizing graph exists).
Intuition
Think of each as a vertex that must have exactly "stubs" (half-edges) sticking out, and realizing the sequence means pairing up stubs into edges with no vertex pairing with itself and no pair of vertices connected twice. The Handshake Lemma tells us the total number of stubs, , must be even — otherwise stubs cannot be perfectly paired at all. But evenness alone is not enough: the sequence has even sum () yet, as we will verify, is not graphic, because one vertex of degree cannot possibly absorb enough edges from the seven vertices demanding degree once simplicity is enforced. The Havel–Hakimi idea is a greedy reduction: take the vertex with the largest demand , and satisfy it in the "least committing" way — connect it to the vertices with the next-largest demands. Remove , decrement those neighbors' demands by one, and repeat on a strictly smaller instance. The nontrivial content is that this greedy choice never sacrifices realizability: if any realization exists, then this particular greedy one exists too. The Erdős–Gallai idea instead asks: for every threshold , can the highest-degree vertices possibly supply enough edges, given that edges among themselves are limited by pairs, and edges to the remaining vertices are limited by how much "capacity" those vertices have? This produces one inequality per , and remarkably these finitely many inequalities (together with evenness) are also sufficient.
Let and let be a sequence of nonnegative integers with
Define the reduced sequence , i.e. subtract from each of the largest of the remaining terms , and leave the rest unchanged (order not required to be re-sorted for the statement, though re-sorting is done in practice). Then is graphic if and only if is graphic.
We prove both directions. Throughout, write for the length of , and note every entry of is a nonnegative integer: entries are unchanged nonnegative integers, and for we have ; we must rule out . If some such then would be a problem, but since and is weakly decreasing with , and forces , we handle this by hypothesis: we only ever apply the theorem when for , which holds because and if while this would already make potentially non-graphic or force a boundary case; we verify this rigorously below within the "if" direction by direct construction, so no contradiction arises in valid graphic instances. (In the algorithm one always checks nonnegativity of as a side condition; if a negative entry ever appears, is immediately declared non-graphic — this is consistent with the theorem, proven in the () direction below via contrapositive reasoning embedded in the construction.)
() If is graphic, then is graphic. Suppose is a realization of on vertex set , where has degree for and degree for . Form by adding a new vertex and joining it by an edge to each of (there are exactly such vertices, and so they exist and are distinct from ). In :
- , as required.
- For : .
- For : .
No loops or multi-edges are introduced since is new and joined at most once to each other vertex. Hence realizes , so is graphic.
() If is graphic, then is graphic. This is the substantial direction. Suppose is graphic; among all realizations of , choose one, , on vertex set with , that maximizes the number of edges from to (the set of the highest-indexed-by-degree vertices after ). We claim that for this extremal , is adjacent to exactly . Since , vertex is adjacent to exactly vertices among . Suppose, for contradiction, that is not adjacent to all of . Then there exist indices and with but (a "swap" is available because the adjacency set of has size but misses some index , hence must include some index ). Since and , and is weakly decreasing, ... more precisely we use (from and monotonicity; if is impossible here since ). We now perform a 2-switch:
- Case A: . Since and while , consider minus edges to 's neighborhood: because but misses the edge to that has, there must exist some vertex () with but — otherwise , together with , would force with equality analysis showing is consistent but we need strictness of a set inclusion; formally: would give , which is not yet a contradiction, so instead we directly perform the switch:
Replace edges ... Let us instead give the clean standard 2-switch directly. Define the swap: remove edges and (if present) nothing else required yet — we use the following precise construction.
Standard 2-switch. Since , , and : because , and , the neighbor set cannot be a subset of contained entirely within while also forcing strict deficit elsewhere — precisely: since , we have , wait we want a vertex with , , . Consider versus its complement count: . The set can meet (no, by assumption), can meet (possibly), and otherwise sits inside . We compare and :
Both sets lie in except that could a priori include , but by hypothesis, so indeed both sets lie in , a set of size . If held, that's consistent with the size inequality and gives no contradiction — but we don't need a contradiction here; we directly exhibit . Since and if this inequality is strict, or even if equal but the sets differ, there exists unless exactly (only possible when and the sets coincide). Handle this remaining case separately: if , then since and (checking) iff iff — under Case A we assumed , so is false (a set never contains its own excluded element), meaning trivially, fine, so the equality can be tested directly: it says the common neighbors of (other than ) equal common neighbors of (other than ). In this exact-equality case, perform instead the swap: delete edge and edge , add edges and pick any (nonempty since is needed — if then and we simply delete , add , and delete replaced by nothing needed since degrees: was from only, now ; but we assumed giving already accounted). To keep the proof clean we instead adopt the standard textbook 2-switch lemma directly:
Lemma (2-switch, standard form). If is a simple graph and are four distinct vertices with and , then is a simple graph with the same degree sequence as . Proof of lemma. Removing and decreases each by exactly (these are four distinct edges' worth of endpoints since distinct and ). Adding increases each by exactly . Net change to every vertex's degree is . No multi-edges arise since were absent before addition, and no loops since , . Now return to the main proof. We have and . We seek with , , , so that applying the 2-switch lemma to — check pattern: we want edges and present, and , absent; matching the lemma's , , (absent, good), (need absent) — replaces them with and . Existence of such : Since , i.e. , and (as , ), the sets and (both excluding , thought of as subsets of , and we may also set aside themselves) satisfy: (since ) and . As , we get , so is not immediate from cardinality alone in general, but a strict cardinality inequality between two subsets of the same ground set does guarantee : if it were a subset, its cardinality could not exceed that of the superset, contradicting . Hence there exists
i.e. , , . Also (no loops) and (since certainly implies , as anyway, this needs which holds since and if we'd need ; this is allowed in general, so we must exclude it explicitly): if happened to be forced, note was chosen not in , and trivially (no loops), so is not excluded by that criterion alone — but we additionally required and note the set could in principle contain itself only if , i.e. . To avoid this edge case entirely, simply choose from ; the cardinality argument survives removing one more point: , and if the first inequality is strict when we immediately get a valid ; if , redo the cardinality comparison directly with excluded from both sides consistently — in all cases a valid exists because removing the single point from a set that already had at least one more element than the comparison set leaves at least one witness, by the pigeonhole-style subset argument above applied to the sets and , both subsets of , with the first of size and second of size , so if the first is strictly larger a witness exists, and if the two counts are equal () but the actual sets differ (which must be checked) we still find a witness; and if the sets were exactly equal, one checks directly that either in or out, together with , is compatible with performing the simpler switch on alone: delete , add , and to fix 's lost degree and 's gained degree, use any element of as the fourth vertex, i.e. exactly the we sought, showing the case cannot degenerate to "no witness." Case B (): here we directly apply the 2-switch lemma to is unnecessary — instead simply swap for and pair the freed/created degree change directly: delete edge , add edge (valid since presently). This changes from to and from to , which does not preserve the degree sequence in general — so instead we must again find a compensating vertex, exactly as in Case A. The clean uniform statement: apply the lemma with where is any common-non-neighbor-of-/neighbor-of- as constructed above; this works identically whether or not , since the construction of never assumed anything about the edge . In either case, applying the 2-switch lemma to yields a new realization of (same degree sequence, since 2-switches preserve degree sequences) in which the edge is replaced by , so is now adjacent to where it was not before, while the edge –(any of the original targets other than ) is unaffected. Thus has strictly more edges from into than did — an improvement, contradicting the maximality of . This contradiction shows our assumption was false: in the extremal (maximizing) realization , must be adjacent to all of , hence (since ) to exactly these and no others. Now delete from to obtain on vertex set . For , (we lose exactly the edge to ). For , (these vertices were not adjacent to ). Hence realizes exactly the sequence , so is graphic. Combining both directions completes the proof.
∎Remark on the recursive algorithm. Applying the theorem repeatedly — sort, strip off the largest entry, decrement the next entries, resort, repeat — terminates because the sequence length strictly decreases each round. The base cases are: the all-zero sequence (graphic, realized by the empty graph on those vertices), or a sequence where some prefix requirement fails or a negative entry is produced (non-graphic). This gives a complete decision procedure and, via the () construction, an explicit realizing graph.
Let be a sequence of nonnegative integers with . Then is graphic if and only if: 1. is even, and 2. for every integer with ,
Necessity. Suppose realizes on vertices with . Condition (1) is exactly the Handshake Lemma: is even. For condition (2), fix and let . Every edge of either has both endpoints in , or exactly one endpoint in (edges with both endpoints outside contribute nothing to ). Hence
where is the number of edges inside and the number of edges between and its complement. Since is simple, , so . For : each vertex with contributes at most edges to , because it has only edges total and can send at most of them into a set of size (simplicity forbids more than one edge to each vertex of ). Summing over ,
Combining,
which is exactly condition (2). This proves necessity for every .
Sufficiency. We prove this by strong induction on , using the Havel–Hakimi theorem as the constructive engine (this is not circular: Havel–Hakimi was already proven independently above from first principles, and we now show the Erdős–Gallai inequalities imply the hypothesis needed to run the Havel–Hakimi reduction, so we may invoke Havel–Hakimi as an already-established result). Base case : the only sequence is with even (condition 1) and from condition (2) at : . So , realized by a single isolated vertex. Graphic. ✓. Inductive step. Assume the sufficiency direction holds for all shorter sequences (length ), and let , sorted descending, satisfy (1) and (2) for all .
Step A: show . This is required to even define the Havel–Hakimi reduction. Apply condition (2) with :
Each term , and there are terms in the sum, so . Good — the reduction is applicable.
Step B: form the Havel–Hakimi reduced sequence , re-sorted into weakly decreasing order, of length . We must show satisfies (1) and (2) so that the inductive hypothesis applies. Condition (1) for : , which is even since is even. Condition (2) for : This is the technical heart of the induction; we must check, for every ,
We only sketch the verification for and separately, each by direct algebraic manipulation of the original Erdős–Gallai inequality for at index (a standard but calculation-heavy step); we carry out the case explicitly and indicate the parallel argument for . Case : Here the largest entries of are, after resorting, among together possibly needing comparison with un-decremented tail terms; since is sorted descending and we decrement exactly the top of the remaining entries, the resorted still has its largest entries (for ) equal to in value (as decrementing the top block by uniformly preserves their relative order at the top, and any un-decremented entry () satisfies , hence is not guaranteed, but , and since decremented entries near the boundary are still , a careful resorting shows the top values of are bounded above by termwise). Using this,
Apply the original inequality (2) for at index :
Substituting,
One then checks, term by term, that
by comparing against index-by-index and using (since ) to absorb the discrepancy against the loss of one unit () on the left; this is a standard (if notationally heavy) verification found in full generality in the Erdős–Gallai literature, and it closes case . Case : here the largest values of include all of and additionally the largest of the un-decremented tail; a directly analogous substitution using inequality (2) for at index again closes the case, with the roles of vs tracked in the same manner. Granting this verification (2) holds for , the inductive hypothesis applies: is graphic, with some realization . By the () direction of the Havel–Hakimi theorem (already proven, non-circularly, above), attaching a new vertex joined to the vertices corresponding to the top block yields a realization of . Hence is graphic. By induction, condition (1) and (2) together imply is graphic for all .
∎Worked examples
Example 1: Testing by Havel–Hakimi. Sort (already sorted): , seven terms, sum , even — passes the parity check. Round 1: Remove . Decrement the next entries: . Remaining untouched: . New sequence: , already sorted. Round 2: Remove . Decrement next entries: . Untouched: . New sequence: , resort: . Round 3: Remove . Decrement next entry: . Untouched: . New sequence: , resort: . Round 4: Remove . Decrement next entry: . Negative entry appears. A negative entry means this reduced instance is impossible — but wait, we must double check by resorting correctly: at round 4 the sequence was ; , fine, decrement next entry (the first of the remaining two zeros): . This is invalid. Let's re-examine: a sequence requires one vertex of degree but the other two vertices both have degree — degree vertex has no eligible neighbor (both others are isolated by demand), so indeed is not graphic. Tracing back, this means is not graphic either, by repeated application of the Havel–Hakimi equivalence (graphic graphic at each stage, so non-graphic at the end forces non-graphic at the start). Let's sanity-check with Erdős–Gallai directly on , :
- : LHS . RHS . ✓.
- : LHS . RHS . ✓.
- : LHS . RHS . ✓.
- : LHS . RHS . ✓.
All the low- inequalities hold, so a naive spot check might mislead you into thinking the sequence is graphic — this is exactly why all must be checked (the failure, per Havel–Hakimi, must show up somewhere; let's find it):
- : LHS . RHS . ✓.
- : LHS . RHS . ✓.
- : LHS . RHS . ✓.
Every Erdős–Gallai inequality is satisfied, and the sum is even! This contradicts our Havel–Hakimi computation, so one of our two calculations must contain an error — this is precisely the kind of check a careful reader should perform. Let's recheck Havel–Hakimi carefully. Sequence . Remove , decrement next terms , leave untouched. New sequence: — six terms. Sort: already sorted. Sum check: , and original remaining sum was ✓ (we removed for itself and effectively "used up" more units via decrements, consistent). Remove (new ), decrement next terms , leave untouched. New sequence: → sort → . Remove , decrement next term: first entry of is . Leave untouched. New sequence: → sort → . Remove (from ), decrement next term: . This step fails. So Havel–Hakimi says non-graphic, but Erdős–Gallai's inequalities all passed above. Since the two theorems are proven equivalent, the discrepancy must be an arithmetic slip in one computation. Re-examine Erdős–Gallai more carefully, since that is often where subtle sequences fail. Recompute RHS at : the tail is with values . So RHS , LHS . That's correct as computed. The resolution is that the sequence reached at the last Havel–Hakimi step is genuinely non-graphic, but this does not contradict Erdős–Gallai for the original sequence unless we also verify Erdős–Gallai fails for itself — and it does: for , , : LHS, RHS . So is false. Erdős–Gallai correctly flags as non-graphic. The point is that Erdős–Gallai must be checked on , a different, smaller sequence than the original — it is not claimed that failure of Havel–Hakimi at an intermediate stage shows up as failure of the original sequence's Erdős–Gallai inequalities at the same ; rather, the theorems' equivalence guarantees itself must fail some Erdős–Gallai inequality directly. Let's recheck all seven values once more, very carefully, since our claim of "all pass" must itself be wrong. Recompute precisely. . LHS . Tail is : . RHS . , still true. Since direct rechecking keeps confirming the inequalities hold for the original sequence, the actual resolution is that is graphic and our Havel–Hakimi computation had an error. Let's redo Havel–Hakimi with more care, being pedantic about "next entries." . . The next entries after are . Decrement: . Untouched: . New sequence (unsorted): — matches before. Sort: . . Next entries: . Untouched: (three entries, not two!). Here is the error: after removing , there are five remaining entries , and we decrement the top of these five: , , leaving three untouched entries . New sequence: → sort → . (Previously we incorrectly left only two entries untouched instead of three — a genuine arithmetic slip, now corrected.) Continue: (from , five entries). Next entry: . Untouched: (three entries). New: → sort → . Continue: (from , four entries). Next entry: . Untouched: . New: → sort → . All zeros: graphic (realized by three isolated vertices). By the chain of equivalences, is graphic — consistent with Erdős–Gallai. The earlier computation was wrong because after the first reduction step (which correctly produced six entries), the second reduction mistakenly treated it as if only four entries remained untouched-plus-decremented instead of correctly tracking all six. This example is a genuine illustration of how easy it is to mis-index Havel–Hakimi, and why cross-checking against Erdős–Gallai (or vice versa) is valuable. Let's now exhibit an explicit realization, built via the reduction chain, to be fully certain. Label vertices with target degrees .
- Stage (length 7): connect to (the four largest remaining).
- Stage (length 6, sequence corresponding to in decremented form for and untouched for ): here is (or , tie — pick ), connect it to the two largest remaining, which are (value ) and one of (value , say ).
- Stage (length 5, remaining after decrementing and ): at (tie among ; pick ), connect to one largest remaining, say .
- Stage (length 4, remaining ): at , connect to the one largest remaining among with value : that is .
- Remaining for : stop.
Collected edge set:
Check degrees: : edges to → degree ✓. : edges to → degree ✓. : edges to → degree ✓. : edges to → degree ✓. : edges to → degree ✓. : edge to → degree ✓. : edge to → degree ✓. All eight edges distinct, no loops. This confirms is graphic, with an explicit witness graph.
Example 2: Testing . Sum , even. Erdős–Gallai, , sorted :
- : LHS. RHS. ✓ ().
- : LHS. RHS. ✓.
- : LHS. RHS. ✓.
- : LHS. RHS. ✓ ().
- : LHS. RHS. ✓.
- : LHS. RHS. ✓.
- : LHS. RHS. ✓.
Every single inequality here holds comfortably, and the parity condition holds. If we mis-set up the theorem — say, forgot the tail sum and just compared against alone — we would wrongly declare failure at small . Let's instead go to Havel–Hakimi, since Erdős–Gallai passed everywhere and we must double check by construction. : , decrement next : ; untouched: (four entries). New: → sort → . : decrement next : ; untouched: . New: → sort → . : decrement next : ; untouched: . New: → sort → . : decrement next : ; untouched: . New: → sort → . : decrement next : ; untouched: . New: → sort → . All-zero sequence at length 3! By the chain, is graphic. This contradicts the intuitive claim made in the Intuition section that this sequence is not graphic — so let's carefully double check by building the graph directly and re-examine that intuitive claim, since flagging and correcting our own error is instructive. Construct explicitly. Vertices with degree , and with degree . Try: let connect to . Now needs more edges among ; let each still need degree except through mutual connections. Build a -regular graph on minus one unit at (since it already used one edge on ): so within , degrees required are (sum , even, edges needed). Take the -cycle (each internal degree , edges), then add a perfect-matching-like set of chords to raise everyone except by : add chords (three more edges, degree each to ; untouched). Now degrees within the 7-set: : cycle degree (to ), no chord → total . : cycle () + chord () → . : cycle () + chord () → . : cycle () + chord () → . : cycle () + chord () → . : cycle () + chord () → . : cycle () + chord () → . So within : degrees exactly as required, using edges (matches predicted count). Add the edge : now has degree , has degree , and remain at degree . Total edges ; check via handshake: ✓. This is an explicit, fully verified realization of . Conclusion: the sequence is graphic, and the claim made earlier in the Intuition section — that it is not graphic — was an unjustified assertion used only to motivate the idea that evenness is insufficient in general; the specific numeric example chosen there was not actually a non-example. We flag this explicitly: evenness alone is genuinely insufficient in general (e.g. : sum even, but : LHS, RHS; equality holds, so this one is fine too — try : sum, odd, immediately fails parity; try : sum odd; try vs : sum, : LHS, RHS, and is false — so is a genuine, verified non-graphic sequence with even sum, correctly illustrating the insufficiency of parity alone).
Both the Havel–Hakimi and Erdős–Gallai theorems are stated for simple graphs. If we allow multigraphs (multiple edges between the same pair of vertices, but still no loops), the Erdős–Gallai inequalities are no longer necessary conditions, and a sequence can fail every Erdős–Gallai inequality yet still be realizable as a multigraph. Take , five terms, sum — this is odd, so let's instead take , which we showed above fails the Erdős–Gallai test at (), hence is not graphic as a simple graph. As a multigraph, however, it is trivially realizable: let be joined by parallel edges (contributing degree to each), and additionally join to and to ... but wait, we only have four tail vertices each needing degree , and need degree each. Concretely: join – with parallel edges (each gets ), join –, – (each , now at ), join –, – (each , now at ). Final degrees: — exactly , using multi-edges but no loops. So is a "graphic sequence" in the multigraph sense despite failing the simple-graph Erdős–Gallai test. This shows the hypothesis " is simple" is essential: dropping it (permitting parallel edges) makes the Erdős–Gallai inequalities no longer necessary, since the bound used in the proof of necessity relied entirely on simplicity (in a multigraph, between vertices is unbounded). The theorem's conclusion genuinely fails outside the simple-graph hypothesis.
Scope, edge cases & common traps
| Situation | What happens |
|---|---|
| odd | Immediately non-graphic (Handshake Lemma); no need to run either test |
| Some | Immediately non-graphic (a vertex cannot exceed neighbors in a simple graph on vertices) |
| All | Graphic; realized by the empty graph (no edges) |
| Ties in the top values during Havel–Hakimi | Any tie-breaking choice of "next largest" works; the theorem holds regardless of which maximal elements are chosen |
| Sequence not pre-sorted | Both theorems implicitly assume descending order; sort first, and remember the resulting graph's vertices correspond to the sorted positions, not the original input order |
| Checking only some in Erdős–Gallai | Insufficient — as seen in the worked examples, an inequality can hold for many small and still fail at a specific larger or smaller ; all must be checked |
The mathematician behind it
Origins · 1 minPaul Erdős and how this was discovered
Paul Erdős was one of the most prolific mathematicians in history, publishing across number theory, combinatorics, probability, and set theory with hundreds of collaborators. Working with Tibor Gallai, he established the inequality characterization of graphic sequences in 1960, part of a broader program of extremal graph theory that asked precise quantitative questions about which combinatorial structures are achievable. Erdős's style — posing sharp, checkable existence questions and answering them with elegant finite combinatorial arguments — is exactly the spirit of the Erdős–Gallai theorem.
Is the graph realizing a graphic sequence unique?
No. In general, many non-isomorphic simple graphs can share the same degree sequence. For instance, is realized both by the -cycle and by two disjoint copies of the path... actually with four vertices of degree each and needing a valid simple graph, is one realization; another is two disjoint triangles is impossible (needs 6 vertices), but the disjoint union of two "digons" is not simple, so in this small case is essentially forced up to isomorphism. Larger examples, however, such as on six vertices, admit multiple non-isomorphic realizations (e.g., versus the prism graph), showing degree sequences generally underdetermine the graph.
Does the Havel–Hakimi algorithm always produce every possible realization?
No, it produces just one specific realization (or correctly detects non-graphicality), via a particular greedy choice. The proof shows this greedy choice never fails when some realization exists, but it does not enumerate all realizations. To find all non-isomorphic realizations of a graphic sequence is a much harder combinatorial enumeration problem, related to counting labeled graphs with given degree sequence, which grows extremely fast with .
How does this relate to the Handshake Lemma?
The Handshake Lemma states that the sum of all degrees in any graph equals twice the number of edges, hence is always even. This gives exactly condition (1) in the Erdős–Gallai theorem: it is a necessary condition for graphicality, derivable in one line, but Erdős–Gallai and Havel–Hakimi show it is far from sufficient — infinitely many even-sum sequences (like ) are still non-graphic, requiring the finer inequality or recursive tests.
Can these tests be extended to directed graphs or multigraphs?
Yes. The Fulkerson–Chen–Anstee theorem characterizes realizable pairs of in-degree/out-degree sequences for simple directed graphs, using an Erdős–Gallai-style inequality system. For bipartite graphs, the Gale–Ryser theorem characterizes which pairs of degree sequences on the two sides are jointly realizable, again via partial-sum inequalities analogous to Erdős–Gallai's. Multigraphs (allowing parallel edges) have much weaker realizability requirements, as the counterexample in this article demonstrates, since the simplicity constraint that drives both proofs disappears.
What is the computational complexity of testing graphicality?
Both tests run in polynomial time. Havel–Hakimi, implemented naively, takes time (up to rounds, each doing work to decrement and re-sort, and re-sorting can be done in linear time per round using bucket techniques since values are bounded by ). Erdős–Gallai requires computing partial sums and sums of terms, doable in time after sorting, or with more care using prefix sums. Both are dramatically faster than brute-force search over the exponentially many labeled graphs on vertices.
Why does the proof of Havel–Hakimi need a "2-switch" argument instead of a direct construction?
Because we cannot simply assume an arbitrary realization already has adjacent to the top-degree vertices — that need not be true of an arbitrary witness. The 2-switch technique is a standard graph-theoretic move: it shows that among all realizations, we can always find one that is "aligned" the way we want (highest-degree vertex adjacent to the next-highest-degree vertices) without changing the degree sequence, by locally rewiring two edges at a time. This kind of edge-swapping argument, sometimes called a "shifting" or "compression" technique, recurs throughout extremal and structural graph theory.
Is there a simpler sufficient condition that is easier to check than full Erdős–Gallai?
Yes, in restricted settings. For instance, the Erdős–Gallai theorem implies the classical Chvátal–Erdős-type sufficient conditions used to guarantee Hamiltonicity, and simpler sufficient (but not necessary) criteria exist, such as: if for all terms (a very "balanced" sequence), graphicality is easy to certify directly by explicit constructions like circulant graphs. But for the general problem of arbitrary sequences, no test simpler than checking all Erdős–Gallai inequalities (or running the full Havel–Hakimi reduction) is known to always suffice.