You could do something like this, to draw nodes from each partition at a particular x
coordinate:
X, Y = bipartite.sets(B)
pos = dict()
pos.update( (n, (1, i)) for i, n in enumerate(X) ) # put nodes from X at x=1
pos.update( (n, (2, i)) for i, n in enumerate(Y) ) # put nodes from Y at x=2
nx.draw(B, pos=pos)
plt.show()
The key is creating the dict
for the the nx.draw
pos
parameter, which is:
A dictionary with nodes as keys and positions as values.
See the docs.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…