Memory allocation failed for AllocateWorkSpace: edegrees


I want to use Metis in a C++ program. When I call
»METIS_PartGraphKway(&n, nodes, edges, NULL, ew, &weightFlag, &numFlag, &nparts, options, &edgecut, part);«,
I get the following output:

Maximum memory used: 1945600 bytes
Current memory used: 1942024 bytes
***Memory allocation failed for AllocateWorkSpace: edegrees. Requested size: -1075196480 bytes
Aborted (core dumped)

This happens with Metis 4 as well as with the 5.0prealpha2. I am new to Metis and I have no idea what goes wrong here. I call the function with reasonable values.

Does anyone know how to solve this problem?

Thanks in advance


RE: Daniel, This probably


This probably happens because the nodes/edges arrays that you provide are not correct.
For example, nodes[n] should the size of the edges array.


RE: I don't think that I

I don't think that I understand you correctly.

I have a graph G with n nodes (0..n-1) and 2*m edges (forward edges and backward edges). The nodes/edges arrays are defined as follows:

idxtype nodes[n];
idxtype edges[this->G.number_of_edges()]; // this->G.number_of_edges() = 2*m

Is this incorrect?


RE: Dan, The two input arrays


The two input arrays that contain the graph structure are xadj and adjncy. For an n-node graph, xadj is
of size n+1, whereas adjncy is of size equal to the sum of the lengths of the adjancy lists of all the
vertices. I believe the manual does a reasonably good job describing the format of these arays.