Reputation: 1868
With this use case I am finding it to hard with Cypher query. Do I need to write stored procedure for it ?
Upvotes: 0
Views: 188
Reputation: 67009
Here is a query that will return every node that is connected via paths up to length 2 to at least k distinct nodes. k is assumed to be passed as a parameter.
k
MATCH (n)-[*..2]-(m) WITH n, COUNT(DISTINCT m) AS ms WHERE ms > $k RETURN n, ms;
Upvotes: 2