Node2Vec java.lang.ArrayIndexOutOfBoundsException

Hi I am currently trying to run node2vec on a weighted graph.

However I am currently getting hit by this Error:
Failed to invoke procedure gds.beta.node2vec.stream: Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 262144 out of bounds for length 262144

The query i am using is:
CALL gds.beta.node2vec.stream(
'cosineGraph',
{
concurrency:4,
embeddingDimension:128,
relationshipWeightProperty: 'rel_weight'
}
) YIELD nodeId, embedding
RETURN gds.util.asNode(nodeId).Node AS name, embedding
ORDER BY embedding ASC

The algorithm works fine when I do not specify 'relationshipWeightProperty'.

I have searched the forums and many reccomend updating the graph data science library.

I am currently using version 1.6.1 of the graph data science library.

Would appreciate any advise on how to resolve this.

Do all of your relationships have a rel_weight property?

Sometimes, when a property is missing values, you'll encounter an error message like this. Can you try specifying a default weight when you load your graph -- eg. setting defaultValue: 0 (see the docs for details on the syntax). If that fixes the error, it means we need to improve our error handling (and throw a better exception!), otherwise we can dig to see what else might be the cause.

I think this is the same issue as reported here: Index -1 out of bounds for length 28088 when calling node2vec in write mode and relationshipWeightProperty set · Issue #119 · neo4j/graph-data-science · GitHub. The fix will be included in the next release (1.6.2).

Depending on how urgent you want a fix, you could also build the GDS plugin locally.
Otherwise, you could set the concurrency to 1, as the bug only affected parallel computations. However the computation will take longer then.

2 Likes