我已經從集合,networkx(如nx)和matplotlib(如plt)導入計數器。我已經在我製作的圖表中獲得了每個節點的度數。但是我想繪製度數與度數頻率的關係。 我嘗試如下:繪製Networkx的整數輸出
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
所以我想知道如果我輸入的是正確的,也是,如果我的邏輯是正確的開始,因爲我我不確定這些頻率甚至會連接到它們的衍生程度,並正確地反映它們。
顯示完整的回溯。它會告訴你在哪一行發生錯誤。 –