Closeness Procedure doesn't work for me

Hey everyoe ,

I am using this query to show closeness :

MATCH (a:Attrib)
WITH collect(a) AS Attributaires
CALL apoc.algo.closeness(['SIMILARITY'],Attributaires,'BOTH') YIELD a , score
RETURN a, score
ORDER BY score DESC

but I am getting this error :

you need to use YIELD node, score - and not a here. The identifiers you can use in YIELD are predefined by the procedure. See APOC manual for this.

1 Like

yes it works when I change "a" with "node" ! thanks Stefan :)

For future you could also try out the algorithms from the Graph Algorithms library - https://neo4j.com/docs/graph-algorithms/current/algorithms/closeness-centrality/

This can be added as a plugin (similar to APOC) and has parallel versions of a bunch of different algorithms.

2 Likes