James Xiang
James Xiang

Reputation: 137

Memory error when running k_cliques_community

I run k_cliques_community on my network data and received a memory error after a long respond time. The code works perfectly fine for my other data but not this one.

c = list(k_clique_communities(G_fb, 3))
list(c[0])

Here is a snap shot of the trace error enter image description here

Upvotes: 1

Views: 320

Answers (3)

notprime
notprime

Reputation: 1

As stated in the networkx documentation:

To obtain a list of all maximal cliques, use list(find_cliques(G)). However, be aware that in the worst-case, the length of this list can be exponential in the number of nodes in the graph.

(this is referred to find_cliques, but it is related to your problem also).

That means, if there is a huge number of cliques, the strings you create with list will be so many that you'll probably run out of memory: strings need more space than int values to be saved. I don't know if there is a work-around tho.

Upvotes: 0

Gambit1614
Gambit1614

Reputation: 8811

I tried running your code on my system with 16 GB RAM and i7 -7700HQ, the kernel died after returning a memory error. I think it's because the computation of k-cliques of size 3 is taking a lot of computational power/memory since you have quite a large no. of nodes and edges. I think you need to look into other ways to find k-cliques, like GraphX - Apache Spark

Upvotes: 1

user8866053
user8866053

Reputation:

You probably have an x32 installation of python. x32 installations are limited to 2 gigabytes of memory regardless of how much system memory you have. This is inconvenient, but it works. Uninstall python and install an x64 installation. Again, it's inconvenient, but it's the only solution that I've ever seen.

Upvotes: 0

Related Questions