networkx 2.8.2 Pypi GitHub Homepage
Other Docs
NotesParametersRaisesReturnsBackRef
joint_degree_graph(joint_degrees, seed=None)

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.

Parameters

joint_degrees : dictionary 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.

seed : integer, random_state, or None (default)

Indicator of random number generation state. See Randomness<randomness> .

Raises

NetworkXError

If joint_degrees dictionary is not realizable.

Returns

G : Graph

A graph with the specified joint degree dictionary.

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

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) >>>
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

networkx.generators.joint_degree_seq.joint_degree_graph

Local connectivity graph

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


GitHub : /networkx/generators/joint_degree_seq.py#143
type: <class 'function'>
Commit: