cypher - neo4j - user suggestion with mutual count -


i have created 5 nodes in neo4j follows.

node 1 {userid:1000, username: a, someotherproperties...} node 2 {userid:2000, username: b, someotherproperties...} node 3 {userid:3000, username: c, someotherproperties...}  node 4 {userid:4000, username: d, someotherproperties...}  node 5 {userid:5000, username: e, someotherproperties...}  

node 1 connected node 2 & 3, , node 2 connected node 1, 3, 4

1 -> 2 1 -> 3 2 -> 1 2 -> 3 2 -> 4 3 -> 4 

now want user suggestion node 1 contain node not connected self mutual count. want result this.

node id  userid  username  mutual count -------  ------  --------  ------------- 4    4000    d         2             (which node 2 & 3) 5    5000    e         0     

i had tried cypher query, didn't success.

please try

start user=node:node_auto_index(name='a'), f=node(*)  match user-[r?:friend*1..2]->(f)  distinct r friendrelation,f  return count(friendrelation),f 

which give number of friend relations every other node depth 2 (friend of friend)


Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -