neo4j / graph-data-science

Source code for the Neo4j Graph Data Science library of graph algorithms.
https://neo4j.com/docs/graph-data-science/current/
Other
596 stars 157 forks source link

Failed to invoke function - Caused by: java.lang.NoSuchMethodError #233

Closed doganMemory closed 1 year ago

doganMemory commented 1 year ago

Describe the bug After updating neo4j and gds, some examples from documentation throws an error.

To Reproduce Following the link prediction example from documentation:

CREATE
 (zhen:Person {name: 'Zhen'}),
 (praveena:Person {name: 'Praveena'}),
 (michael:Person {name: 'Michael'}),
 (arya:Person {name: 'Arya'}),
 (karin:Person {name: 'Karin'}),

 (zhen)-[:FRIENDS]->(arya),
 (zhen)-[:FRIENDS]->(praveena),
 (praveena)-[:WORKS_WITH]->(karin),
 (praveena)-[:FRIENDS]->(michael),
 (michael)-[:WORKS_WITH]->(karin),
 (arya)-[:FRIENDS]->(karin)
 MATCH (p1:Person {name: 'Michael'})
 MATCH (p2:Person {name: 'Karin'})
 RETURN gds.alpha.linkprediction.adamicAdar(p1, p2) AS score

Failed to invoke function `gds.alpha.linkprediction.adamicAdar`: Caused by: java.lang.NoSuchMethodError: 'java.lang.Iterable org.neo4j.graphdb.Node.getRelationships(org.neo4j.graphdb.Direction)'

GDS version: 2.2.3 Neo4j version: 5.0.1 Operating system: Ubuntu 20.04

CALL gds.list("adamicAdar")
YIELD name, description
RETURN name, description;
"name" "description "
"gds.alpha.linkprediction.adamicAdar" "Given two nodes, calculate Adamic Adar similarity"

Expected behavior It is expected to get a scalar value from this algorithm.

Mats-SX commented 1 year ago

Hello @doganMemory and thank you for reporting this issue.

I can confirm that I can reproduce the bug also with our latest version 2.2.4. We will investigate and get back to you with a fix.

All the best Mats

Mats-SX commented 1 year ago

Hello again @doganMemory. We have identified the problem and fixed it. It will be included in the next patch release of GDS, which is scheduled for this week -- so stay tuned.

If you cannot wait, there is a workaround. The problem is related to the Neo4j version used, so if you can use Neo4j 4.4 instead, you should be able to run the above also with GDS 2.2.3.

I hope this helps. I will keep the issue open until we have released a version that can be verified to work with Neo4j 5.

Mats

laeg commented 1 year ago

@doganMemory we've pushed out 2.2.5 now which should contain the fix, would you mind testing it?

Thanks for raising this and let us know if you've got any more issues :)

All the best, LG