I am doing graph clustering with python. The algorithm requires that the data passed from graph G should be adjacency-matrix. However, in order to get adjacency-matrix as numpy-array like this:
import networkx as nx
matrix = nx.to_numpy_matrix(G)
I get a memory error. The message is MemoryError: Unable to allocate 2.70 TiB for an array with shape (609627, 609627) and data type float64
However, my device is new (Lenovo E490), windows 64 bit, memory 8 Gb
Other important information could be:
Number of nodes: 609627
Number of edges: 915549
The entire story is as follows:
Graphtype = nx.Graph()
G = nx.from_pandas_edgelist(df, 'source','target', edge_attr='weight', create_using=Graphtype)
Markov Clustering
import markov_clustering as mc
import networkx as nx
matrix = nx.to_scipy_sparse_matrix(G) # build the matrix
result = mc.run_mcl(matrix) # run MCL with default parameters
MemoryError
