NetworkX

Previous topic

networkx.generators.degree_seq.havel_hakimi_graph

Next topic

networkx.generators.degree_seq.is_valid_degree_sequence_havel_hakimi

networkx.generators.degree_seq.degree_sequence_tree

networkx.generators.degree_seq.degree_sequence_tree(deg_sequence, create_using=None)

Make a tree for the given degree sequence.

A tree has #nodes-#edges=1 so the degree sequence must have len(deg_sequence)-sum(deg_sequence)/2=1