Return a simple random graph with the given degree sequence.
If the maximum degree in the sequence is then the algorithm produces almost uniform random graphs in time where is the number of edges.
Parameters : | sequence : list of integers
seed : hashable object, optional
tries : int, optional
|
---|---|
Returns : | G : Graph
|
Raises : | NetworkXUnfeasible :
NetworkXError :
|
See also
is_valid_degree_sequence, configuration_model
Notes
The generator algorithm [R194] is not guaranteed to produce a graph.
References
[R194] | (1, 2) Moshen Bayati, Jeong Han Kim, and Amin Saberi, A sequential algorithm for generating random graphs. Algorithmica, Volume 58, Number 4, 860-910, DOI: 10.1007/s00453-009-9340-1 |
Examples
>>> sequence = [1, 2, 2, 3]
>>> G = nx.random_degree_sequence_graph(sequence)
>>> sorted(G.degree().values())
[1, 2, 2, 3]