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

Triangle count with node labels produce out of index exception

Open tomasonjo opened this issue 3 years ago • 0 comments
trafficstars

When using Triangle count with nodeLabels parameter, I get an array out of index exception.

I tried reproducing on a smaller dataset, but it didn't work. I am using the POLE dataset in Neo4j sandbox: https://github.com/neo4j-graph-examples/pole

Sandbox is using:

Neo4j 4.4.5 GDS 2.0.1

Project the graph:

CALL gds.graph.project.cypher('social', 
  'MATCH (p:Person) RETURN id(p) AS id, CASE WHEN exists ((p)-[:PARTY_TO]->()) THEN ["CrimeAssociates"] ELSE ["Person"] END as labels', 
  'MATCH (p1:Person)-[:KNOWS]-(p2:Person) RETURN id(p1) AS source, id(p2) AS target')

Execute triangle count:

CALL gds.triangleCount.stream('social', {nodeLabels:['CrimeAssociates']}) 
YIELD nodeId, triangleCount as triangles
WITH gds.util.asNode(nodeId) AS node, triangles
RETURN node.name AS name, node.surname AS surname, node.nhs_no AS id, triangles
ORDER BY triangles DESC
LIMIT 5;

I get the error:

Failed to invoke procedure gds.triangleCount.stream: Caused by: java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 19

tomasonjo avatar Apr 26 '22 17:04 tomasonjo