is_digraphical¶

is_digraphical
(in_sequence, out_sequence)[source]¶ Returns True if some directed graph can realize the in and outdegree sequences.
Parameters:  in_sequence (list or iterable container) – A sequence of integer node indegrees
 out_sequence (list or iterable container) – A sequence of integer node outdegrees
Returns: valid – True if in and outsequences are digraphic False if not.
Return type: Notes
This algorithm is from Kleitman and Wang [1]. The worst case runtime is O(s * log n) where s and n are the sum and length of the sequences respectively.
References
[1] D.J. Kleitman and D.L. Wang Algorithms for Constructing Graphs and Digraphs with Given Valences and Factors, Discrete Mathematics, 6(1), pp. 7988 (1973)