neo4j-contrib / neo4j-graph-algorithms

Efficient Graph Algorithms for Neo4j
https://github.com/neo4j/graph-data-science/
GNU General Public License v3.0
767 stars 196 forks source link

Cannot pass parameters in `algo.dfs.stream` call #930

Open maxlazarus opened 4 years ago

maxlazarus commented 4 years ago

Tried to follow instructions for passing parameters on https://neo4j.com/docs/graph-algorithms/3.5/projected-graph-model/cypher-projection/#cypher-projection-parameters

Using Neo4j 3.5.3, graph-algorithms 3.5.4.0

Example: Query 1: setup nodes and relationships

create (:TestNode{key:1, name:"A"})-[:CONNECTS]->(:TestNode{key:2, name:"B"})

Query 2: setup param

:param name => 'B'

Query 3 succeeds, the $name param is present but not used in the projection:

MATCH (start:TestNode{key:1})
CALL algo.dfs.stream(
    'match (t:TestNode) return id(t) as id',
    'match (t:TestNode)-[c:CONNECTS]->(u:TestNode) return id(t) as source, id(u) as target',
    '>',
    id(start),
    {
        graph:'cypher',
        params: {name: $name}
    }
)
YIELD nodeIds
UNWIND nodeIds AS nodeId
WITH algo.asNode(nodeId) AS n
RETURN n

Query 4 fails:

MATCH (start:TestNode{key:1})
CALL algo.dfs.stream(
    'match (t:TestNode) where t.name <> $name return id(t) as id',
    'match (t:TestNode)-[c:CONNECTS]->(u:TestNode) return id(t) as source, id(u) as target',
    '>',
    id(start),
    {
        graph:'cypher',
        params: {name: $name}
    }
)
YIELD nodeIds
UNWIND nodeIds AS nodeId
WITH algo.asNode(nodeId) AS n
RETURN n

Error: Neo.ClientError.Procedure.ProcedureCallFailed: Failed to invoke procedurealgo.dfs.stream: Caused by: org.neo4j.cypher.ParameterNotFoundException: Expected parameter(s): name

AliciaFrame commented 4 years ago

Please see the preview release of the Graph Data Science library (https://github.com/neo4j/graph-data-science), or download the jar from our download center -- the preview documents are here.

We're transitioning to the GDS, so hopefully the updated graph loaders will address your issues. If you continue to run into problems, please open an issue on the new repo.