# Node2Vec java.lang.ArrayIndexOutOfBoundsException

**URL:** <https://community.neo4j.com/t/node2vec-java-lang-arrayindexoutofboundsexception/40610>\
**Category:** Graph Data Science / Graph Analytics\
**Created:** [June 29, 2021, 3:41pm UTC](https://community.neo4j.com/t/node2vec-java-lang-arrayindexoutofboundsexception/40610 "2021-06-29T15:41:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![guaizw](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/guaizw/32/15356_2.png) [@guaizw](https://community.neo4j.com/u/guaizw)\
**Post date:** [June 29, 2021, 3:41pm UTC](https://community.neo4j.com/t/node2vec-java-lang-arrayindexoutofboundsexception/40610/1 "2021-06-29T15:41:45Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![alicia\_frame1](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/alicia_frame1/32/6998_2.png) [@alicia\_frame1](https://community.neo4j.com/u/alicia_frame1)\
**Post date:** [June 30, 2021, 1:51am UTC](https://community.neo4j.com/t/node2vec-java-lang-arrayindexoutofboundsexception/40610/2 "2021-06-30T01:51:53Z")

</div>

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](https://neo4j.com/docs/graph-data-science/current/management-ops/native-projection/#_relationship_properties)). 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.

---

<div class="post-metadata">

**Author:** ![florentin\_dorre](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/florentin_dorre/32/18241_2.png) [@florentin\_dorre](https://community.neo4j.com/u/florentin_dorre)\
**Post date:** [June 30, 2021, 7:35am UTC](https://community.neo4j.com/t/node2vec-java-lang-arrayindexoutofboundsexception/40610/3 "2021-06-30T07:35:15Z")

</div>

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](https://github.com/neo4j/graph-data-science/issues/119). 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.
