Showing results for 
Search instead for 
Did you mean: 

Algorithm queries in latest version of Neo4j - GDS syntax update

Node Clone

Hi, I'm working on a project that began on an older version of Neo4j (3.5) and has slightly different syntax, particularly regarding algorithms. I'm trying to 'update' the following query to work with GDS:



'MATCH (p:Publication) RETURN id(p) as id',
'MATCH (p1:Publication)-[r1:HAS_WORD]->(w)<-[r2:HAS_WORD]-(p2:Publication) 
WHERE r1.occurrence > 5 AND r2.occurrence > 5
RETURN id(p1) as source, id(p2) as target, count(w) as weight',
{graph:'cypher',write:false, weightProperty : "weight"}) yield nodeId, label
with label, collect(algo.asNode(nodeId)) as nodes where size(nodes) > 2
MERGE (c:PublicationLPACommunity {id : label})
FOREACH (n in nodes |
return label, nodes



The main issues are likely the first part (algo.labelPropagation) and (algo.asNode) since these have changed in GDS. Here is the error that is returned:



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

Procedure has signature: :: STRING?, configuration  =  Map{} :: MAP?) :: nodeId :: INTEGER?, communityId :: INTEGER?
meaning that it expects at least 1 argument of type STRING?
Description: The Label Propagation algorithm is a fast algorithm for finding communities in a graph. (line 1, column 1 (offset: 0))



Any help much appreciated!


Best to check out the docs, afaik there is also a migration part

the GDS library now works exclusively on in-memory graphs that are prepared under a name,

so you cannot any longer project and run the algorithm in one go, you need to project the data first and then run any number of algorithms, filters, ml-algos or prediction pipelines on the in-memory graph(s).

Nodes 2022
NODES 2022, Neo4j Online Education Summit

On November 16 and 17 for 24 hours across all timezones, you’ll learn about best practices for beginners and experts alike.