_to_stublist(degree_sequence)
degree_sequence
is a list of nonnegative integers representing the degrees of nodes in a graph.
This function returns a list of node numbers with multiplicities according to the given degree sequence. For example, if the first element of degree_sequence
is 3
, then the first node number, 0
, will appear at the head of the returned list three times. The node numbers are assumed to be the numbers zero through len(degree_sequence) - 1
.
Returns a list of degree-repeated node numbers.
>>> degree_sequence = [1, 2, 3]
... _to_stublist(degree_sequence) [0, 1, 1, 2, 2, 2]
>>> degree_sequence = [2, 0, 1]See :
... _to_stublist(degree_sequence) [0, 0, 2]
The following pages refer to to this document either explicitly or contain code examples using this.
networkx.generators.degree_seq._to_stublist
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them