neo4j-contrib / neo4j-graph-algorithms

Efficient Graph Algorithms for Neo4j
https://github.com/neo4j/graph-data-science/
GNU General Public License v3.0
769 stars 195 forks source link

algo.degree breaks when degree > 10000 #848

Closed tomasonjo closed 5 years ago

tomasonjo commented 5 years ago

example graph:

UNWIND range(1,10005) as s
CREATE (:Node{id:s});

MATCH (n:Node)
WITH n limit 1
MATCH (m:Node)
WHERE id(n) <> id(m)
CREATE (m)-[:REL]->(n);

Run the algo:

CALL algo.degree.stream("Node", "REL", {direction: "incoming"})
YIELD nodeId, score
RETURN algo.getNodeById(nodeId).id AS name, score AS followers
ORDER BY followers DESC

Error:

Neo.ClientError.Procedure.ProcedureCallFailed: Failed to invoke procedure algo.degree.stream: Caused by: java.lang.ArrayIndexOutOfBoundsException: 10000

mneedham commented 5 years ago

I think this commit fixes it (by doing pretty much the same thing)

https://github.com/neo4j-contrib/neo4j-graph-algorithms/commit/81c8bfb0d7acabb8f2d9eae4f9dcc4b8fc914d9d

On Wed, 3 Apr 2019 at 18:56, Nulleye notifications@github.com wrote:

I have a similar issue, I think I've solved it by adding the starts... line in the for loop in the compute() funtion on DegreeCentrality.java class. I think the starts array is not correctly initialized. Maybe someone can check this out and create a pull request?

public void compute() { ... for (int i = 0; i < taskCount; i++) { starts[i] = (long) batchSize * i;

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/neo4j-contrib/neo4j-graph-algorithms/issues/848#issuecomment-479594697, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAzpAl09j8i-rO59ZfsN49TG6YieADyks5vdOtngaJpZM4cE3CP .