networkx.generators.community.connected_caveman_graph¶
-
connected_caveman_graph
(l, k)[source]¶ Returns a connected caveman graph of
l
cliques of sizek
.The connected caveman graph is formed by creating
n
cliques of sizek
, then a single edge in each clique is rewired to a node in an adjacent clique.Parameters: - l (int) – number of cliques
- k (int) – size of cliques
Returns: G – connected caveman graph
Return type: NetworkX Graph
Notes
This returns an undirected graph, it can be converted to a directed graph using
nx.to_directed()
, or a multigraph usingnx.MultiGraph(nx.caveman_graph(l, k))
. Only the undirected version is described in [1] and it is unclear which of the directed generalizations is most useful.Examples
>>> G = nx.connected_caveman_graph(3, 3)
References
[1] Watts, D. J. ‘Networks, Dynamics, and the Small-World Phenomenon.’ Amer. J. Soc. 105, 493-527, 1999.