cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Help converting examples to GDS library

How can I find out how to convert the Cypher examples using the Graph Algorithms library to using the new GDS library?

So far I have the GDS library installed in Neo4j 3.5.17 using Neo4j Desktop 1.2.6. I could not figure out how to install GDS with Neo4j 4.0.3. Reading through the discussions here makes me think I should be moving forward with the Graph Data Science library instead of trying to solve the library installation problem I have with the earlier Graph Algorithms library.

When I try this example from the book with my own guesswork conversion to use GDS,

MATCH (source:Place {id: "Amsterdam"}), (destination:Place {id: "London"})
CALL gds.alpha.shortestPath.stream(source, destination, null) YIELD nodeId, cost
RETURN gds.getNodeById(nodeId).id AS place, cost

I get this error,

Procedure call provides too many arguments: got 3 expected no more than 2.

Procedure gds.alpha.shortestPath.stream has signature: gds.alpha.shortestPath.stream(graphName :: ANY?, configuration  =  {} :: MAP?) :: nodeId :: INTEGER?, cost :: FLOAT?
meaning that it expects at least 1 argument of type ANY?
Description: The Shortest Path algorithm calculates the shortest (weighted) path between a pair of nodes using the Dijkstra algorithm. (line 1, column 81 (offset: 80))
"MATCH (source:Place {id: "Amsterdam"}),
(destination:Place {id: "London"})
CALL gds.alpha.shortestPath.stream(source, destination, null) YIELD nodeId, cost
RETURN gds.getNodeById(nodeId).id AS place, cost"

I am sure I will get better at understading Cypher error messages but until then if anyone can suggest what I need to do or understand to use GDS that would be great!

4 REPLIES 4

We have a migration guide here: https://neo4j.com/docs/graph-data-science/current/appendix-b/

It explains how to convert the syntax from the graph algorithms library over to the GDS.

For the book specifically, the fabulous @tomaz.bratanic published a blog post that detailed converting the graph algorithms from the book to GDS: https://towardsdatascience.com/introducing-the-neo4j-graph-data-science-plugin-with-examples-from-th...

Many thanks! Tomaz's article looks very useful.

Are there plans for a Neo4j only GDS version of the book?

We've just recently updated the book so it uses the Syntax from the GDS library -- you should be able to download an updated copy here: https://neo4j.com/graph-algorithms-book/