Gds.beta.graph.project.subgraph issues with parameters given from Python

Hi there!

Please kindly advise how can I manage this:

ClientError: {code: Neo.ClientError.Procedure.ProcedureCallFailed} {message: Failed to invoke procedure `gds.beta.graph.project.subgraph`: Caused by: java.lang.NullPointerException: Cannot invoke "java.lang.Number.doubleValue()" because "resolvedParameter" is null}

Here is my code:

def create_louv_subgraphs(tx, name, given_id):
    result = tx.run(
                    """CALL gds.beta.graph.project.subgraph(
                          '$name',
                          'louv_interactions',
                          'n.louv_community = $given_id',
                          '*'
                        )
                        YIELD graphName, fromGraphName, nodeCount, relationshipCount
                        """,name = name, given_id = given_id
                    )

with driver.session(database="mytest") as session:
    result = session.execute_write(create_louv_subgraphs, name = "8207", given_id = 8207)

I tried to give "given_id" as a string ans as a float but there is the same effect. Please clarify what I do wrong? Shall I use concatenation in this case?
Normally, query is works in database like this:

CALL gds.beta.graph.project.subgraph(
  'comm_8207',
  'louv_interactions',
  'n.louv_community = 8207',
  '*'
)

I think you need to include the params in the call as mentioned in the docs:

CALL gds.beta.graph.project.subgraph(
                          '$name',
                          'louv_interactions',
                          'n.louv_community = $given_id',
                          '*',
                       {parameters: { given_id: $given_id }}
                        )
                        YIELD graphName, fromGraphName, nodeCount, relationshipCount

So you input the param to the subgraph projection procedure and then use the parameter within the procedure.

1 Like

Further I can recommend checking out our python client for GDS (The Neo4j Graph Data Science Client Manual v1.6 - Neo4j Graph Data Science Client).