【发布时间】:2016-03-21 08:07:00
【问题描述】:
我从集合、networkx(作为 nx)和 matplotlib(作为 plt)导入了计数器。我已经在我制作的图表中获取了每个节点的度数。但后来我想绘制度数与度数的关系。 我的尝试如下:
deg=list(G.degree().values())# set the degree for each node
for i in deg:# iterate this list
count=Counter(i)#count the frequency of the nodes
plt.plot(count, i)#plot frequency vs degree
但是我不断收到错误:
TypeError: 'int' object is not iterable
所以我想知道我的输入是否正确,以及我的逻辑一开始是否正确,因为我不确定这些频率甚至会链接回它们的派生度并正确绘制它们。
【问题讨论】:
-
显示完整的回溯。它会显示错误发生在哪一行。
标签: python matplotlib networkx