NetworkX

Previous topic

havel_hakimi_graph

Next topic

degree_sequence_tree

directed_havel_hakimi_graph

directed_havel_hakimi_graph(in_deg_sequence, out_deg_sequence, create_using=None)[source]

Return a directed graph with the given degree sequences.

Parameters :

in_deg_sequence : list of integers

Each list entry corresponds to the in-degree of a node.

out_deg_sequence : list of integers

Each list entry corresponds to the out-degree of a node.

create_using : graph, optional (default DiGraph)

Return graph of this type. The instance will be cleared.

Returns :

G : DiGraph

A graph with the specified degree sequences. Nodes are labeled starting at 0 with an index corresponding to the position in deg_sequence

Raises :

NetworkXError :

If the degree sequences are not digraphical.

Notes

Algorithm as described by Kleitman and Wang [R253].

References

[R253](1, 2) D.J. Kleitman and D.L. Wang Algorithms for Constructing Graphs and Digraphs with Given Valences and Factors Discrete Mathematics, 6(1), pp. 79-88 (1973)