Showing results for 
Search instead for 
Did you mean: 

Head's Up! Site migration is underway. Phase 2: migrate recent content

Out of time error while running closeness centrality algorithm

Graph Buddy

I ran the following query

CALL algo.closeness('alias', 'through_citations', {graph:'huge', direction: 'BOTH', write:true, writeProperty:'GraphProperty_closeness.centrality_throughCitations'})
YIELD nodes,loadMillis, computeMillis, writeMillis;

and got the following error after couple of hours.

Failed to invoke procedure `algo.closeness`: Caused by: java.lang.IllegalThreadStateException: Attempted to submit tasks for 39064 times with a 100000 nanosecond delay (0 milliseconds) between each attempt, but ran out of time

On the other hand,

CALL apoc.periodic.iterate(
  "MATCH (comp:GraphProperty_wcc_throughCitations) RETURN comp.GraphProperty_component AS component", 
  "CALL algo.closeness('MATCH (n:alias  {GraphProperty_wcc_throughCitations : $component}) RETURN id(n) AS id',
  'MATCH (n)-[r:through_citations]-(m:alias) RETURN id(n) AS source, id(m) AS target, r.weight as weight', 
  {graph:'cypher', params: {component: component}, write:true, writeProperty:'GraphProperty_closeness_centrality2_throughCitations'})
  YIELD nodes,loadMillis, computeMillis, writeMillis
  RETURN nodes,loadMillis, computeMillis, writeMillis", {batchSize:5000, iterateList:true})           
YIELD batches, total, errorMessages
RETURN batches, total, errorMessages;

where I try to run the algorithm separately for each connected component, the algorithm is running for over 2 days.

Please let me know how to troubleshoot this.