joint_degree_graph(joint_degrees, seed=None)
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.
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.
Indicator of random number generation state. See Randomness<randomness>
.
If joint_degrees dictionary is not realizable.
A graph with the specified joint degree dictionary.
Generates a random simple graph with the given joint degree dictionary.
>>> joint_degrees = {See :
... 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) >>>
The following pages refer to to this document either explicitly or contain code examples using this.
networkx.generators.joint_degree_seq.joint_degree_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