Relative Content

Tag Archive for pythonpython-3.xnetworkx

How to code this kind of graph in python using networkx?

I would like to create a graph where the first node is node 0, then there are 2 parameters n and l.
n represents the degree of the node, l the number of layers.
After the first node 0, this node should be linked to n different nodes, this is layer 1.
Then each of those nodes should be linked with n-1 different and distinct nodes so it has a degree n (this is layer 2) and so on.
The last layer is made with nodes with degree 1 since they are connected just with their parents nodes.
I would like to code this in python using networkx, ideas/suggestions/solutions ?