networkx 2.8.2 Pypi GitHub Homepage
Other Docs
NotesParameters
_neighbor_switch(G, w, unsat, h_node_residual, avoid_node_id=None)

Notes

First, it selects w_prime, an unsaturated node that has the same degree as w . Second, it selects switch_node, a neighbor node of w that is not connected to w_prime. Then it executes an edge swap i.e. removes ( w ,*switch_node*) and adds (w_prime,*switch_node*). Gjoka et. al. [1] prove that such an edge swap is always possible.

Parameters

G : NetworkX graph

Graph in which the neighbor switch will take place.

w : integer

Node id for which we will execute this neighbor switch.

unsat : set of integers

Set of unsaturated node ids that have the same degree as w.

h_node_residual: dictionary of integers :

Keeps track of the remaining stubs for a given node.

avoid_node_id: integer :

Node id to avoid when selecting w_prime.

Releases one free stub for w , while preserving joint degree in G.

Examples

See :

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#80
type: <class 'function'>
Commit: