【发布时间】:2018-07-27 21:17:03
【问题描述】:
图表 1:
邻接表:
2: [2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 14]
3: [2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 14]
5: [2, 3, 4, 5, 6, 7, 8, 9]
剧情:
`import networkx as nx
G = nx.Graph()
G1 = nx.Graph()
import matplotlib.pyplot as plt
for i, j in adj_list.items():
for k in j:
G.add_edge(i, k)
pos = nx.spring_layout(G)
nx.draw(G, with_labels=True, node_size = 1000, font_size=20)
plt.draw()
plt.figure() # To plot the next graph in a new figure
plt.show() `
在图2中,我正在消除一些边并重新绘制图形,但是节点的位置正在改变,如何存储下一个图形的节点位置?
【问题讨论】:
标签: python-3.x matplotlib networkx