graph-data-science-client icon indicating copy to clipboard operation
graph-data-science-client copied to clipboard

Idempotent pageRank

Open Mintactus opened this issue 1 year ago • 1 comments

The pageRank algo from the Python client is not idempotent.

I got this error: neo4j.exceptions.ClientError: {code: Neo.ClientError.Procedure.ProcedureCallFailed} {message: Failed to invoke procedure gds.pageRank.mutate: Caused by: java.lang.UnsupportedOperationException: Node property pageRank already exists}

Could we have a replace option?

Also

Mintactus avatar Aug 24 '24 00:08 Mintactus

Hi @Mintactus,

none of our mutate algorithm procedures have an option to overwrite existing properties, which is by design. New property values, even if produced by the same algorithm on the same data, do not necessarily have to be the same data, by values or semantically. So, we can't assume that overwriting is safe and put up some hoops to get to that outcome.

In order to overwrite a property, you have to first drop it and then run the mutate algorithm again:

CALL gds.graph.nodeProperties.drop('g', 'property')
CALL gds.<algo>.mutate('g', {'mutateProperty': 'property', ...})

I'm gonna leave this issue open for now, since we could add a failIfMissing options to the config for nodeProperties.drop, to align it with graph.drop.

knutwalker avatar Aug 26 '24 16:08 knutwalker

The failIfMissing options has been added to 2.10.1 and the latest GDS is 2.15.0, I'll be closing this as released.

knutwalker avatar Mar 07 '25 15:03 knutwalker

Thanks amazing

Mintactus avatar Mar 07 '25 16:03 Mintactus