> Unfortunately coo_matrix appears to be a very space inefficient > format. It seems to take about three times the RAM of the original > graph. coo_matrix() stores the matrix in three arrays: data, row_ind and col_ind. The number of elements in each array is the number of nonzero elements in the matrix such that data[i] is placed in the matrix at (row[i], col[i]). So, in theory, the memory required should be proportional to the number of nonzero elements.
You could try csc_matrix() or csr_matrix() instead; these use alternative representations that should take up less space. However, the key problem here is that there is a point in time when your graph is effectively stored three times in memory: - first you load it with igraph into a Graph object - next, the graph object is converted into the data, rows and cols arrays. (At this point, you could probably delete the igraph graph from memory). - finally, the arrays are turned into a SciPy matrix. In theory, setting "graph" to None after the data, cols and rows arrays were constructed and calling Python's garbage collector should release the memory occupied by the graph, although it is probably never returned to the OS -- Python will keep it to itself in case it is neeed later for something else. T. _______________________________________________ igraph-help mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/igraph-help
