- graphscope.nx.generators.community.connected_caveman_graph(l, k)#
Returns a connected caveman graph of l cliques of size k.
The connected caveman graph is formed by creating n cliques of size k, then a single edge in each clique is rewired to a node in an adjacent clique.
l (int) – number of cliques
k (int) – size of cliques (k at least 2 or NetworkXError is raised)
G – connected caveman graph
- Return type:
NetworkXError – If the size of cliques k is smaller than 2.
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)