在python中计算特征值时的内存错误

时间:2017-04-17 12:38:09

标签: python numpy graph out-of-memory networkx

我试图找到一个大图的邻接矩阵的特征值(465,017个节点,834,797个边)。我尝试使用NetworkX adjacency_spectrum方法查找值。当我编译时,我有一个内存错误。

  Traceback (most recent call last):
  File "5.py", line 19, in <module>
    w=nx.adjacency_spectrum(G)
  File "/home/aiym/anaconda3/lib/python3.5/site-packages/networkx/linalg/spectrum.py", line 75, in adjacency_spectrum
    return eigvals(nx.adjacency_matrix(G,weight=weight).todense())
  File "/home/aiym/anaconda3/lib/python3.5/site-packages/scipy/sparse/base.py", line 691, in todense
    return np.asmatrix(self.toarray(order=order, out=out))
  File "/home/aiym/anaconda3/lib/python3.5/site-packages/scipy/sparse/compressed.py", line 920, in toarray
    return self.tocoo(copy=False).toarray(order=order, out=out)
  File "/home/aiym/anaconda3/lib/python3.5/site-packages/scipy/sparse/coo.py", line 252, in toarray
    B = self._process_toarray_args(order, out)
  File "/home/aiym/anaconda3/lib/python3.5/site-packages/scipy/sparse/base.py", line 1009, in _process_toarray_args
    return np.zeros(self.shape, dtype=self.dtype, order=order)
MemoryError

你能帮我解决这个问题吗?或建议其他方法来计算没有内存错误的特征值

0 个答案:

没有答案