neo4j-graph-algorithms
neo4j-graph-algorithms copied to clipboard
k-shortest path array index out of bound
This error seems to come up when using nodeQuery and/or relationshipQuery param.
To reproduce:
LOAD CSV WITH HEADERS FROM
"https://raw.githubusercontent.com/geoiq/acetate/master/places/Europe-z4-z6.txt"
as row FIELDTERMINATOR "\t"
MERGE (city:City{name: row.name})
ON CREATE SET city.population = toINT(row.population),
city.latitude = toFloat(row.latitude),
city.longitude = toFloat(row.longitude)
MERGE (country:Country{code: row.`country code`})
MERGE (city)-[:IS_IN]->(country)
create rels:
WITH 250 as distanceInKm
MATCH (c1:City),(c2:City)
WHERE id(c1) < id(c2)
WITH c1,c2,
distance(point({longitude:c1.longitude,latitude:c1.latitude}),
point({longitude:c2.longitude,latitude:c2.latitude})) as distance
WHERE distance < (distanceInKm * 1000)
MERGE (c1)-[l:LINK]->(c2)
ON CREATE SET l.distance = distance
This works as intended but loads all nodes and relationships...
MATCH (start:City{name:"Ljubljana"}),(end:City{name:"Amsterdam"})
CALL algo.kShortestPaths(start, end, 3, 'distance'
,{direction:'BOTH'})
YIELD resultCount, loadMillis, evalMillis, writeMillis
RETURN resultCount
When trying to filter out nodes and rels
MATCH (start:City{name:"Ljubljana"}),(end:City{name:"Amsterdam"})
CALL algo.kShortestPaths(start, end, 3, 'distance'
,{nodeQuery:'Country',relationshipQuery:'LINK',direction:'BOTH'})
YIELD resultCount, loadMillis, evalMillis, writeMillis
RETURN resultCount
I get
Failed to invoke procedure
algo.kShortestPaths: Caused by: java.lang.ArrayIndexOutOfBoundsException: -1
Might be related to #634
A similar errors occurs when you insert a not existing label in the projection. Just trying on an empty graph:
CALL algo.closeness.stream( 'MATCH (p:Test) RETURN id(p) as id', 'MATCH (p1:Test)-[:MANAGE]->(p2:Test) RETURN id(p1) as source, id(p2) as target', {graph:'cypher'} );
It will return a java.lang.ArrayIndexOutOfBoundsException