Traceback (most recent call last):
File "cluster_network.py", line 19, in <module>
result = mc.run_mcl(matrix, inflation=inflation)
File "/home/itan_lab/david/.conda/envs/goflof/lib/python3.7/site-packages/markov_clustering/mcl.py", line 228, in run_mcl
matrix = iterate(matrix, expansion, inflation)
File "/home/itan_lab/david/.conda/envs/goflof/lib/python3.7/site-packages/markov_clustering/mcl.py", line 132, in iterate
matrix = expand(matrix, expansion)
File "/home/itan_lab/david/.conda/envs/goflof/lib/python3.7/site-packages/markov_clustering/mcl.py", line 51, in expand
return matrix ** power
File "/home/itan_lab/david/.conda/envs/goflof/lib/python3.7/site-packages/scipy/sparse/base.py", line 667, in __pow__
return tmp * tmp
File "/home/itan_lab/david/.conda/envs/goflof/lib/python3.7/site-packages/scipy/sparse/base.py", line 480, in __mul__
return self._mul_sparse_matrix(other)
File "/home/itan_lab/david/.conda/envs/goflof/lib/python3.7/site-packages/scipy/sparse/compressed.py", line 509, in _mul_sparse_matrix
np.asarray(other.indices, dtype=idx_dtype))
RuntimeError: nnz of the result is too large
Script:
import markov_clustering as mc
import networkx as nx
import pandas as pd
g = nx.Graph()
chem_interactions = pd.read_csv('chemical_chemical.links.v5.0.tsv', sep="\t")
chem_interactions.columns = ['chem1', 'chem2', 'score']
chem_interactions = chem_interactions.query('score > 0')
for index, row in chem_interactions.iterrows():
g.add_edge(row['chem1'], row['chem2'], weight=float(row['score']))
matrix = nx.to_scipy_sparse_matrix(g)
for inflation in [i / 10 for i in range(15, 26)]:
result = mc.run_mcl(matrix, inflation=inflation)
clusters = mc.get_clusters(result)
Q = mc.modularity(matrix=result, clusters=clusters)
print("inflation:", inflation, "modularity:", Q)
Traceback:
Script:
Any idea whats going wrong here?