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:
CALL algo.labelPropagation.stream(
'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 |
MERGE (n)-[:IN_LPA_COMMUNITY]->(c)
)
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 gds.labelPropagation.stream has signature: gds.labelPropagation.stream(graphName :: 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))
"CALL gds.labelPropagation.stream("
^
Any help much appreciated!
According to the syntax I know about the LPA algorithm, which is used for finding communities in a graph, it seems you are using a different syntax by including MATCH statement. You can find the syntax of the stream mode in Label Propagation
You can check the exapmle of the social network graph in the website as well