connected_caveman_graph(l, k)
The connected caveman graph is formed by creating :None:None:`n`
cliques of size k
, then a single edge in each clique is rewired to a node in an adjacent clique.
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.
If the size of cliques k
is smaller than 2.
connected caveman graph
Returns a connected caveman graph of l
cliques of size k
.
>>> G = nx.connected_caveman_graph(3, 3)See :
The following pages refer to to this document either explicitly or contain code examples using this.
networkx.generators.community.ring_of_cliques
networkx.generators.community.caveman_graph
networkx.generators.community.connected_caveman_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