Closeness Procedure doesn't work for me

apoc

(Mehdi Ajroud) #1

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 :


(Stefan Armbruster) #2

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.


(Mehdi Ajroud) #3

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


(Mark Needham) #4

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.