Graphicallity#

Undirected degree sequence#

is_graphic(degree_seq: List[int]) bool#
template<std::ranges::forward_range Range>
requires degree_range<Range>
bool is_graphic(Range &&degree_sequence)#

Checks if the sequence can be the degree sequence of a valid undirected graph, containing no multi-edges or loops, based on the Erdős–Gallai algorithm [8, 9].

Directed degree-pair sequence#

is_digraphic(in_out_degree_sequence: List[Pair[int, int]]) bool#

Checks if the sequence can be the degree-pair sequence of a valid directed graph, containing no multi-edges or loops, based on the algorithm by Kleitman and Wang [10].

A degree pair sequence is a range (list) of pairs (2-tuples) of integers, where the first element of each item represents in-degree and the second item out-degree of one vertex.