I'm using Neo4j to find the degree of connection between users. I have data in the follower shape:
(user)-[:INTERACTS_WITH]->(user)
So if user_1 interact with user_2 and user_2 interacts with user_3, then user_1 and user_3 share a second-degree connection.
Ideally, I would like to get the following dataset like this in return:
degree count
NULL 123
1 1050
2 3032
3 2110
... ...
Is there a better way to do this than to simply run shortestPath() function for every pair of users? If not, then what is the best way to loop over users in Neo4j?
Also, I imagine the direction plays a role here, so would you recommend making this relationship bidirectional, so that for every (user1)-[:INTERACTS_WITH]->(user2)
I would also create the reverse relationship (user2)-[:INTERACTS_WITH]->(user1)
?
If you have any tips on how to create the above dataset, please let me know.
Many thanks!