Warning

This documents an unmaintained version of NetworkX. Please upgrade to a maintained version and see the current NetworkX documentation.

networkx.algorithms.graphical.is_valid_degree_sequence_havel_hakimi

is_valid_degree_sequence_havel_hakimi(deg_sequence)[source]

Returns True if deg_sequence can be realized by a simple graph.

The validation proceeds using the Havel-Hakimi theorem. Worst-case run time is \(O(s)\) where \(s\) is the sum of the sequence.

Parameters:deg_sequence (list) – A list of integers where each element specifies the degree of a node in a graph.
Returns:valid – True if deg_sequence is graphical and False if not.
Return type:bool

Notes

The ZZ condition says that for the sequence d if

\[|d| >= \frac{(\max(d) + \min(d) + 1)^2}{4*\min(d)}\]

then d is graphical. This was shown in Theorem 6 in [1].

References

[1]I.E. Zverovich and V.E. Zverovich. “Contributions to the theory of graphic sequences”, Discrete Mathematics, 105, pp. 292-303 (1992).

[havel1955], [hakimi1962], [CL1996]