networkx 2.8.2 Pypi GitHub Homepage
Other Docs
ParametersRaisesReturnsBackRef
relaxed_caveman_graph(l, k, p, seed=None)

A relaxed caveman graph starts with l cliques of size k. Edges are then randomly rewired with probability p to link different cliques.

Parameters

l : int

Number of groups

k : int

Size of cliques

p : float

Probabilty of rewiring each edge.

seed : integer, random_state, or None (default)

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

Raises

NetworkXError

If p is not in [0,1]

Returns

G : NetworkX Graph

Relaxed Caveman Graph

Returns a relaxed caveman graph.

Examples

>>> G = nx.relaxed_caveman_graph(2, 3, 0.1, seed=42)
See :

Back References

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

networkx.generators.community.relaxed_caveman_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/community.py#121
type: <class 'function'>
Commit: