I have the following set of nodes:
n = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
Using networkx package, I want to create 4 random connected graphs where each contain 5 nodes from the above list in such a way that the label of the node should appear in the newly formed graph.
For example:
subgraph_1 = [1, 5, 9, 13, 17]
subgraph_2 = [2, 6, 10, 14, 18]
subgraph_3 = [3, 7, 11, 15, 19]
subgraph_4 = [4, 8, 12, 16, 20]
Is there a way to accomplish this using the built in packages functions of networkx? I could not locate anything in the documentation.
Another way that this could work is that, I can create a random graph with 20 nodes using: G=nx.erdos_renyi_graph(n=20,p=0.1) but then I would be needing to divide this into random 4 subgraphs with each one having 5 nodes. The edges can be regenerated randomly and do not have to be linked or similar to the edges of the main graph G.
