neo4j / graph-data-science

Source code for the Neo4j Graph Data Science library of graph algorithms.
https://neo4j.com/docs/graph-data-science/current/
Other
597 stars 157 forks source link

Triangle count with node labels produce out of index exception #188

Closed tomasonjo closed 1 year ago

tomasonjo commented 2 years ago

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

IoannisPanagiotas commented 1 year ago

This has been fixed as per 2.0.4