cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

How to find graph centre of Subgraph

Hello I am working on a huge graph over 1 billion nodes. I have created a subgraph after performing some filters where I am keeping 2 hop distance from particular node . I need to find out the centre node or list of centre nodes using cypher. can you give some guidelines. I need to check centre nodes for further analysis purpose
Thank you

3 REPLIES 3

szenyo
Node Clone

If you want to calculate graph centrality, then you can use the Graph Algorithms plugin, and you can use PageRank for example.
https://neo4j.com/docs/graph-algorithms/current/algorithms/page-rank/

Thanks for your answer
I want to find a graph centre where its eccentricity is equal to radius. The graph centre node or nodes are most influential nodes I suppose.

szenyo
Node Clone

I see.
So, the diameter is the maximum shortest path I guess, so you can do something like this:

MATCH (a:Node), (b:Node) WHERE id(a) > id(b)
MATCH p=shortestPath((a)-[:RELATIONSHIP*]-(b))
WITH length(p) AS len, p
ORDER BY len DESC LIMIT 1
RETURN len, extract(x IN nodes(p) | x) AS path

Then you can check the path at half way. This is my quick guess.