networkx 2.8.2 Pypi GitHub Homepage
Other Docs
NotesParametersRaisesReturnsBackRef
directed_joint_degree_graph(in_degrees, out_degrees, nkk, seed=None)

Notes

Similarly to the undirected version: In each iteration of the "while loop" the algorithm picks two disconnected nodes v and w, of degree k and l correspondingly, for which nkk[k][l] has not reached its target yet i.e. (for given k,l): n_edges_add < nkk[k][l]. It then adds edge (v,w) and always 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 disconnected nodes v and w, for which nkk[degree(v)][degree(w)] has not reached its target, even if one or both nodes do not have free stubs. If either node v or w does not have a free stub, we perform a "neighbor switch", an edge rewiring move that releases a free stub while keeping nkk the same.

The difference for the directed version lies in the fact that neighbor switches might not be able to rewire, but in these cases unsaturated nodes can be reassigned to use instead, see [1] for detailed description and proofs.

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

Parameters

degree_seq : list of tuples (of size 3)

degree sequence contains tuples of nodes with node id, in degree and out degree.

nkk : dictionary of dictionary of integers

directed joint degree dictionary, for nodes of out degree k (first level of dict) and nodes of in degree l (second level of dict) describes the number of edges.

seed : hashable object, optional

Seed for random number generator.

Raises

NetworkXError

If degree_seq and nkk are not realizable as a simple directed graph.

Returns

G : Graph

A directed graph with the specified inputs.

Generates a random simple directed graph with the joint degree.

Examples

>>> in_degrees = [0, 1, 1, 2]
... out_degrees = [1, 1, 1, 1]
... nkk = {1: {1: 2, 2: 2}}
... G = nx.directed_joint_degree_graph(in_degrees, out_degrees, nkk) >>>
See :

Back References

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

networkx.generators.joint_degree_seq.directed_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#478
type: <class 'function'>
Commit: