This documents an unmaintained version of NetworkX. Please upgrade to a maintained version and see the current NetworkX documentation.
Returns a connected caveman graph of
lcliques of size
The connected caveman graph is formed by creating
ncliques of size
k, then a single edge in each clique is rewired to a node in an adjacent clique.
G – connected caveman graph
This returns an undirected graph, it can be converted to a directed graph using
nx.to_directed(), or a multigraph using
nx.MultiGraph(nx.caveman_graph(l, k)). Only the undirected version is described in  and it is unclear which of the directed generalizations is most useful.
>>> G = nx.connected_caveman_graph(3, 3)
 Watts, D. J. ‘Networks, Dynamics, and the Small-World Phenomenon.’ Amer. J. Soc. 105, 493-527, 1999.