cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Gds ShortestPaths error

dan3
Node Link

Hi,
We are using Graph Data Science library, and we got this error message:
neo4j.exceptions.ClientError: Failed to invoke proceduregds.alpha.kShortestPaths.stream: Caused by: java.lang.IllegalArgumentException: Failed to load a relationship because its target-node with id 1523 is not part of the node query or projection. To ignore the relationship, set the configuration parameter relationshipValidation to false.

My question is what we need to do to ignore the relationship validation, where we need to put the relationshipValidation parameter.

Thanks,

7 REPLIES 7

Can you share the query you used to call shortest path? My guess is that either the start or end node you specified is not in the graph you supplied to the algorithm.

Ultimately, both the start and end node must be contained within the subgraph specified by the nodeProjection and relationshipProjection. For example:

MATCH (start:Loc {name: 'A'}), (end:Loc {name: 'F'})
CALL gds.alpha.shortestPath.stream({
  nodeProjection: 'Loc',
  relationshipProjection: {
    ROAD: {
      type: 'ROAD',
      properties: 'cost',
      orientation: 'UNDIRECTED'
    }
  },
  startNode: start,
  endNode: end,
  relationshipWeightProperty: 'cost'
})
YIELD nodeId, cost
RETURN gds.util.asNode(nodeId).name AS name, cost

For a longer explanation, I'd look to the docs: https://neo4j.com/docs/graph-data-science/current/alpha-algorithms/shortest-path/#algorithms-shortes...

dan3
Node Link

Thanks for the answer Alicia.
I'm simply looking to set the "relationshipValidation" parameter to false.
My question is - where should this parameter be added? I couldn't find a documentation for this anywhere and I'd really appreciate your help.
Thanks.

Were you able to find the way to include relationshipValidation parameter in the
CALL gds.graph.create.cypher
query?

In the source code, there is only single instance of "relashipshipvalidation", which is in the exception file; making it hard to figure where the parameter has to be put while creating a GDS graph using CYPHER projection. @alicia.frame, could you help us figure out?

Hello @dan3,

I figured out the way around this issue. You can add validateRelationships:false to your code. See using the example below.

MATCH (start:Loc {name: 'A'}), (end:Loc {name: 'F'})
CALL gds.alpha.shortestPath.stream({
  nodeProjection: 'Loc',
  relationshipProjection: {
    ROAD: {
      type: 'ROAD',
      properties: 'cost',
      orientation: 'UNDIRECTED'
    }
  },
  startNode: start,
  endNode: end,
  relationshipWeightProperty: 'cost',
  validateRelationships:false
})
YIELD nodeId, cost
RETURN gds.util.asNode(nodeId).name AS name, cost