# joint_degree_graph#

joint_degree_graph(joint_degrees, seed=None)[source]#

Generates a random simple graph with the given joint degree dictionary.

Parameters:
joint_degreesdictionary of dictionary of integers

A joint degree dictionary in which entry `joint_degrees[k][l]` is the number of edges joining nodes of degree k with nodes of degree l.

seedinteger, random_state, or None (default)

Indicator of random number generation state. See Randomness.

Returns:
GGraph

A graph with the specified joint degree dictionary.

Raises:
NetworkXError

If joint_degrees dictionary is not realizable.

Notes

In each iteration of the “while loop” the algorithm picks two disconnected nodes v and w, of degree k and l correspondingly, for which `joint_degrees[k][l]` has not reached its target yet. It then adds edge (v, w) and increases the number of edges in graph G by one.

The intelligence of the algorithm lies in the fact that it is always possible to add an edge between such disconnected nodes v and w, even if one or both nodes do not have free stubs. That is made possible by executing a “neighbor switch”, an edge rewiring move that releases a free stub while keeping the joint degree of G the same.

The algorithm continues for E (number of edges) iterations of the “while loop”, at the which point all entries of the given `joint_degrees[k][l]` have reached their target values and the construction is complete.

References

Examples

```>>> joint_degrees = {
...     1: {4: 1},
...     2: {2: 2, 3: 2, 4: 2},
...     3: {2: 2, 4: 1},
...     4: {1: 1, 2: 2, 3: 1},
... }
>>> G = nx.joint_degree_graph(joint_degrees)
>>>
```
{"ft_lang_label":"__label__en","ft_lang_prob":0.8270607,"math_prob":0.9804568,"size":1600,"snap":"2023-40-2023-50","text_gpt3_token_len":411,"char_repetition_ratio":0.15726817,"word_repetition_ratio":0.0077220076,"special_character_ratio":0.26375,"punctuation_ratio":0.1918239,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9780632,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-09-28T03:27:08Z\",\"WARC-Record-ID\":\"<urn:uuid:cf75a6b8-87b2-413c-b574-b5faf371a6a8>\",\"Content-Length\":\"48847\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:45128eb0-6222-4685-936b-245157f598f0>\",\"WARC-Concurrent-To\":\"<urn:uuid:29198924-9d05-4754-8fa3-47399a74e92e>\",\"WARC-IP-Address\":\"185.199.109.153\",\"WARC-Target-URI\":\"https://networkx.org/documentation/latest/reference/generated/networkx.generators.joint_degree_seq.joint_degree_graph.html\",\"WARC-Payload-Digest\":\"sha1:PAVOZNCCTPUJEQRKAU3MBTYKK7D37EHM\",\"WARC-Block-Digest\":\"sha1:GPRBHGAD3MBBZB2BORIE5WBLSAOBHB5A\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-40/CC-MAIN-2023-40_segments_1695233510358.68_warc_CC-MAIN-20230928031105-20230928061105-00122.warc.gz\"}"}