gds.shortestPath.yens.stream is throwing Source node does not exist in the in-memory graph: `id1` Target node does not exist in the in-memory graph: `id2`

Hi All, I've been getting this below error for my sample cypher query. Is g the in-memory graph here? I tried checking what's in g but I wasn't with the allowed gds commands. a and z in the query are giving out the 33033 and 22624 ids that the yens algo is looking for. So I'm not really understanding the issue. Those ids exists in the neo4j db but not really sure if they do in in-memory graph. how do I check that? how to fix this issue?

error
Failed to invoke procedure gds.shortestPath.yens.stream: Caused by: java.lang.IllegalArgumentException: Multiple errors in configuration arguments:
Source node does not exist in the in-memory graph: 33033
Target node does not exist in the in-memory graph: 22624

cypher query:

MATCH p = (n:EquipmentNode)-[Q:CONNECTED_TO]-(m:EquipmentNode)
WHERE (Q.type IN ['type1'] AND Q.availableChannels > 0 ) AND Q.networkId IN ['network1'] AND Q.bandwidth IN ['bandwidth1'] AND Q.status IN ['status1'] AND ( NOT ((Q.aSiteName = "siteName1" AND Q.zSiteName = "siteName2") OR (Q.aSiteName = "siteName2" AND Q.zSiteName = "siteName1")) )
WITH gds.graph.project( 'rakesh', n, m, {
  relationshipProperties: Q { .mileage
}} ) AS g
MATCH (s:SiteNode {
  meccaCode: 'code1'
})-[rl:CONNECTED_TO]-(a:EquipmentNode)
WHERE (a.locationClli CONTAINS s.siteName OR s.siteName CONTAINS a.locationClli) AND toUpper(a.networkType)='ULH' AND NOT (toUpper(a.equipmentTid) CONTAINS 'TEST')
WITH a.equipmentTid AS tid_A, g
MATCH pp=(a:EquipmentNode)-[rel:CONNECTED_TO]-(a1:EquipmentNode)
WHERE a.equipmentTid=tid_A AND ALL( t IN relationships(pp)
WHERE t.type IN ['type1'] AND (t.totalChannels > 0 AND t.totalChannelsUsed < t.totalChannels) AND t.networkId IN ['network1'] AND t.bandwidth IN ['bandwidth1'] AND t.status IN ['status1'] )
WITH a, g
MATCH (d:SiteNode {
  meccaCode: 'code2'
})-[rl:CONNECTED_TO]-(z:EquipmentNode)
WHERE (z.locationClli CONTAINS d.siteName OR d.siteName CONTAINS z.locationClli) AND toUpper(z.networkType)='ULH' AND NOT (toUpper(z.equipmentTid) CONTAINS 'TEST')
WITH z.equipmentTid AS tid_Z, a, g
MATCH pp=(z:EquipmentNode)-[rel:CONNECTED_TO]-(z1:EquipmentNode)
WHERE z.equipmentTid=tid_Z AND ALL( t IN relationships(pp)
WHERE t.type IN ['type1'] AND (t.totalChannels > 0 AND t.totalChannelsUsed < t.totalChannels) AND t.networkId IN ['network1'] AND t.bandwidth IN ['bandwidth1'] AND t.status IN ['status1'] )
WITH DISTINCT z, a, g
CALL gds.shortestPath.yens.stream( 'rakesh', {
  sourceNode: a, targetNode: z, k:1, relationshipWeightProperty: 'mileage'
})
YIELD index, sourceNode, targetNode, totalCost, nodeIds, costs, path
WITH index, sourceNode, targetNode, totalCost, costs, path, nodeIds, gds.util.asNode(sourceNode).nodeId AS startNode, gds.util.asNode(targetNode).nodeId AS endNode, gds.util.asNode(sourceNode).locationClli AS startLocation, gds.util.asNode(targetNode).locationClli AS endLocation, size(nodeIds)-1 AS noOfLinks, [nodeId IN nodeIds | gds.util.asNode(nodeId).locationClli] AS clliInRoutes, [nodeId IN nodeIds | gds.util.asNode(nodeId).nodeId] AS tidsInRoutes
UNWIND relationships(path) AS subPath
WITH index, sourceNode, targetNode, totalCost, costs, path, nodeIds, startNode, endNode, startLocation, endLocation, clliInRoutes, tidsInRoutes, noOfLinks, apoc.rel.startNode(subPath) AS subPathStartNode, apoc.rel.endNode(subPath) AS subPathEndNode, apoc.any.properties(subPath).cost AS subPathCost
MATCH p = (subPathStartNode)-[route:CONNECTED_TO]-(subPathEndNode)
WHERE (route.type IN ['type1'] AND route.availableChannels > 0 ) AND route.networkId IN ['network1'] AND route.bandwidth IN ['bandwidth1'] AND route.status IN ['status1'] AND NOT (route.trailName IN ['trailName1'])
WITH index, sourceNode, targetNode, totalCost, costs, path, nodeIds, startNode, endNode, startLocation, endLocation, clliInRoutes, tidsInRoutes, noOfLinks, subPathStartNode, subPathEndNode, subPathCost, p, 10^2 AS factor
UNWIND relationships(p) AS routes
RETURN index+1 AS routeNumber, noOfLinks, totalCost AS algoTotalCost, round(factor*totalCost)/factor AS totalCost, costs, subPathCost, routes.mileage AS mileage, round(factor*routes.cost)/factor AS cost, tidsInRoutes, clliInRoutes, startLocation AS routeASiteName, endLocation AS routeZSiteName, routes.aSiteName AS linkASiteName, routes.zSiteName AS linkZSiteName,
CASE WHEN startNode IS null AND startLocation=routes.zSiteName THEN routes.zEquipmentTid WHEN startNode IS null AND startLocation=routes.aSiteName THEN routes.aEquipmentTid ELSE startNode END AS routeAEquipmentTid,
CASE WHEN endNode IS null AND endLocation=routes.zSiteName THEN routes.zEquipmentTid WHEN endNode IS null AND endLocation=routes.aSiteName THEN routes.aEquipmentTid ELSE endNode END AS routeZEquipmentTid, routes.aEquipmentTid AS linkAEquipTid, routes.zEquipmentTid AS linkZEquipTid, routes.trailId AS linkTrailId, routes.trailName AS linkName,
CASE WHEN routes.trailNameAlias = '-' OR routes.trailNameAlias IS null THEN routes.trailName ELSE routes.trailNameAlias END AS linkTrailNameAlias, routes.networkId AS linkNetworkId, routes.subNetworkId AS linkSubNetworkId, routes.totalChannels AS linkTotalChannels, routes.totalChannelsUsed AS linkTotalChannelsUsed, routes.capacityUtilization AS capacityUtilization, routes.linkColorByUtilization AS linkColorByUtilization, routes.pathId AS linkPathId, routes.latency AS latency, routes.rtd AS rtd, routes.type AS linkType, routes.aSiteId AS linkASiteId, routes.zSiteId AS linkZSiteId, routes.aSiteStatus AS linkASiteStatus, routes.zSiteStatus AS linkZSiteStatus, routes.aSiteLatitude AS aSiteLatitude, routes.aSiteLongitude AS aSiteLongitude, routes.zSiteLatitude AS zSiteLatitude, routes.zSiteLongitude AS zSiteLongitude, routes.aSiteLata AS linkASiteLata, routes.zSiteLata AS linkZSiteLata, routes.aSiteScisCode AS linkASiteScisCode, routes.zSiteScisCode AS linkZSiteScisCode, routes.aSiteMeccaCode AS linkASiteMeccaCode, routes.zSiteMeccaCode AS linkZSiteMeccaCode, routes.aSiteRegion AS linkASiteRegion, routes.zSiteRegion AS linkZSiteRegion, routes.aSiteMarket AS linkASiteMarket, routes.zSiteMarket AS linkZSiteMarket, routes.aSiteAddress AS linkASiteAddress, routes.zSiteAddress AS linkZSiteAddress, routes.aSiteCity AS linkASiteCity, routes.zSiteCity AS linkZSiteCity, routes.aSiteState AS linkASiteState, routes.zSiteState AS linkZSiteState, routes.aSiteZip AS linkASiteZip, routes.zSiteZip AS linkZSiteZip, routes.aSiteCountry AS linkASiteCountry, routes.zSiteCountry AS linkZSiteCountry, routes.aEquipmentId AS linkAEquipmentId, routes.zEquipmentId AS linkZEquipmentId, routes.aEquipmentName AS linkAEquipmentName, routes.zEquipmentName AS linkZEquipmentName, routes.aEquipmentType AS linkAEquipmentType, routes.zEquipmentType AS linkZEquipmentType, routes.aFunctionalType AS linkAFunctionalType, routes.zFunctionalType AS linkZFunctionalType, routes.aEquipmentModel AS linkAEquipmentModel, routes.zEquipmentModel AS linkZEquipmentModel, routes.aEquipmentVendor AS linkAEquipmentVendor, routes.zEquipmentVendor AS linkZEquipmentVendor, routes.aRelayRack AS linkARelayRack, routes.zRelayRack AS linkZRelayRack, routes.aEquipmentPhyShelfNo AS linkAEquipmentPhyShelfNo, routes.zEquipmentPhyShelfNo AS linkZEquipmentPhyShelfNo, routes.aEquipmentLogShelfNo AS linkAEquipmentLogShelfNo, routes.zEquipmentLogShelfNo AS linkZEquipmentLogShelfNo, routes.aEquipmentPhysicalTid AS linkAEquipmentPhysicalTid, routes.zEquipmentPhysicalTid AS linkZEquipmentPhysicalTid, routes.aPortAid AS linkAPortAid, routes.zPortAid AS linkZPortAid ORDER BY
CASE WHEN totalCost <=0 THEN noOfLinks ELSE totalCost END, routeNumber ASC

Hello @rakesh ,
the error indicates that the nodes are not part of the GDS graph.

I suspect, there is an issue with the WHERE clauses.
Best to check why the node f.i. node 33033 is not part of the projection (which parts of your lower WHERE clauses it does not match with).
Maybe create some smaller queries which only contain parts of the WHERE clauses and find out on which the node is filtered out.

You could inspect the gds graph as explained in the docs (here).
But directly asserting on the Cypher result should work fine in this case, as you are not chaining multiple GDS algorithms.

Hi @florentin_dorre , I did try checking why is it not part of the graph with the gds.graph.nodeproperties.stream('rakesh') YIELD nodeId, property, value but it only throws following: Procedure call does not provide the required number of arguments: got 1 expected at least 2 (total: 4, 2 of which have default values).

I tried with the other one gds.graph.nodeProperty.stream('rakesh', 'nodeId'). may be I'm messing the syntax of how to use this? Could you please give me a sample? I tried several things but none work for me.

query: CALL gds.graph.nodeProperty.stream('rakesh','nodeId') yield nodeId where nodeId in [33033, 22624] return nodeId

error: Failed to invoke procedure gds.graph.nodeProperty.stream: Caused by: java.lang.IllegalArgumentException: Expecting at least one node projection to contain property key(s) ['nodeId'].

@rakesh ,
the procedure only works with an existing nodeProperty.
As you dont have any projected, I would suggest to run degree-centrality on mutate-mode before (essentially a NO-OP).

Hi @florentin_dorre , I figured this out. the filters that I applied for connections in the in-memory graph I used them to a and z as well. That made sure it has all the same nodes in a, z and the projected graph. So far it worked with the datapoints I had. I'm doing so more testing on them to be absolutely certain of this. Thank you for response on this I really appreciate it.

1 Like