Neo4J GDS Staff Please Verify GDS 1.6 Path Finding Algo Examples Fail to Write to Neo4J Database

I have searched for a similar topic and did not find one, so here goes:
System: MacBookPro, OS 11.5.1, Intel Chipset
Neo4J: Enterprise v4.3.2
GDS: v1.6

I have meticulously (copied) the GDS 1.6 Examples (Section 3) for:

  1. Dijkstra Source Target
  2. Dijkstra Single Source
  3. Yens
    And all is well, until the last step when writing from the mutated graph projection to the database. All have failed with the following error:

    I checked the API call and the call setup looks fine. I verified that the totalCost property was mutated correctly:

Can someone from Neo4J verify the .write() issue associated with these algorithms. BTW: I stopped with these, assuming the bug was ubiquitous.

Thanks...

Anyone at Neo4J have a chance to look at this yet? Thanks.

Hello @skerr ,
thank you for reporting the error!
I could verify the error and it seems to occur when running Yens multiple times with different modes.
Running f.i. only write mode works.

I hope this can be a workaround for now and we will investigate further in the meantime.

Update: Using mutate + writeRelationship worked for me.

The problem lies in the chained execution of the examples.

On mutate, you create a new relationship type in the in-memory graph. The created PATH relationships only have the property totalCost but not cost.

When you execute the write example afterwards, GDS checks if all relationships have a cost property defined. This is not the case for the newly created PATH relationships.
To exclude the newly created PATH relationships, specify relationshipTypes: ['ROAD'].

1 Like

Florentin: Thank you for verifying the issue. My follow-up question:
I thought the entire point of the chained execution is the ability to write the optimized relationship PATH and the relevant properties between the sourceNode and targetNode back in the Neo4J database. In your comment you note to exclude the PATH relationship. Why?

Florentin: Skipping the mutate execution mode and proceeding directly to the write execution mode works fine.

We have three main modes for our algorithms: stream, mutate, write.

Stream - Directly returns the results, easy to inspect but inefficient to persist.
Mutate - Writes the result into the GDS in-memory graph (not persisted on the neo4j db). The results can be used in following GDS algorithm/procedure calls.
Write - Writes the result into the neo4j db. Not usable in GDS without projecting a new graph.

However, after mutate you dont need to recompute the result to write it back to the neo4j db.
To simply write the computed result back to Neo4j you can use (https://neo4j.com/docs/graph-data-science/current/management-ops/graph-catalog-ops/#catalog-graph-write-relationship)