Running centrality algorithms

  1. I get the following error when I use the harmonic centrality algorithm:
CALL algo.closeness.harmonic.stream(
  'MATCH (n:alias) RETURN id(n) AS id',
  "MATCH (n)-->(m:alias) RETURN id(n) AS source, id(m) AS target",
  {graph: "cypher", direction: 'BOTH'})
YIELD nodeId, centrality
WITH algo.asNode(nodeId) AS node, centrality AS centrality_h_stream
SET node.harmonic_centrality = centrality_h_stream

Neo.ClientError.Procedure.ProcedureCallFailed

Neo.ClientError.Procedure.ProcedureCallFailed: Failed to invoke procedure algo.closeness.harmonic.stream: Caused by: java.lang.NullPointerException

I added the lines the following lines in neo4j.conf file with no luck
"dbms.security.procedures.unrestricted=apoc., algo. dbms.security.procedures.whitelist=apoc., algo."

  1. Also I am wondering if dropping "direction: 'BOTH'" would change the results - it does not seem to make a difference when I a similar algorithm :
CALL algo.closeness.stream(
  'MATCH (n:alias) RETURN id(n) AS id',
  "MATCH (n)-->(m:alias) RETURN id(n) AS source, id(m) AS target",
  {graph: "cypher", direction: 'BOTH'})
YIELD nodeId, centrality
WITH algo.asNode(nodeId) AS node, centrality AS centrality_stream
SET node.centrality = centrality_stream

Hi @lavanya.kannan - the harmonic variant of closeness centrality was an experimental implementation that our labs team implemented as a proof of concept. The null pointer exception is a bug, and no configuration changes will fix it, unfortunately :confused:. We're deprecating the harmonic variant in our next release. We recommend using the closeness centrality algorithm instead.

Hi @alicia.frame Thanks for the clarification.

  1. Harmonic Centrality would be a good measure to use. Would be nice to have it back working.

  2. Please see my other post on handling directionality while computing closeness centrality: Running closeness centrality with or without directions