I am attempting to use METIS (configured for 64-bit, with a Python interface) to perform some weighted graph partitioning, but am immediately being hit with a memory allocation failure:

   Current memory used:        3288 bytes
   Maximum memory used:        3288 bytes
***Memory allocation failed for SetupGraph: adjwgt. Requested size: 1125152056413312 bytes
Traceback (most recent call last):
  File "/home/nate/Desktop/Atom/DTW/testing.py", line 21, in <module>
    edgecuts, parts = metis.part_graph(G, 3)
  File "/home/nate/.local/lib/python3.10/site-packages/metis.py", line 800, in part_graph
  File "/home/nate/.local/lib/python3.10/site-packages/metis.py", line 676, in _METIS_PartGraphKway
    return _METIS_PartGraphKway.call(nvtxs, ncon, xadj, adjncy, vwgt, vsize,
  File "/home/nate/.local/lib/python3.10/site-packages/metis.py", line 501, in _result_errcheck
    if result == METIS_ERROR_MEMORY: raise METIS_MemoryError

My code simply acquires the edges from memory (~53k edges), then builds the graph in NetworkX, transfers it to METIS and attempts the partitioning:

G = metis.networkx_to_metis(G)   
edgecuts, parts = metis.part_graph(G, 3)

The error occurs during the part_graph call. Is this unusual behavior, or does it really take ~1000 TB for a graph this large? (I have 64 GB of RAM).

The graph contains 328 nodes where each node is connected to every other node. Could this be the source of the bizarre memory requirement?

Edit: limiting the problem to just a few edges results in: Segmentation fault (core dumped), but no other information to diagnose the issue.


1 Answer 1


I had this error when I passed parameter nvtxs = n+1 instead of n, where n is number of vertices in a graph. According to the METIS manual value of nvtxs must be equal to n, while length of the array xadj must be equal to n+1.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.