# Memory allocation failed for AllocateWorkSpace: edegrees

Hello,

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

Daniel

Submitted by dk_uka on Sun, 2007-06-03 03:30

## RE: Daniel, This probably

Daniel,

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.

george

## 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?

Daniel

## RE: Dan, The two input arrays

Dan,

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.