I am trying to write a query to find all nodes with outdegree X and only return the paths that contains those nodes when path length is equal to Y
If I want to get only nodes with outdegree X I use the following Cypher query
MATCH (s:URL)-[r:VISITED*]->(t:URL)
WITH s, count(t) as degreeout
WHERE 73 in s.job_id and degreeout <4
return s, degreeout
If I want to get only paths with length = X I use the following query
MATCH p=(s:URL)-[r:VISITED*]->(t:URL)
WHERE length(p)=7
return p
I tried the combine the previous two queries in the following query
MATCH (s:URL)-[r:VISITED*]->(t:URL)
WITH s, COLLECT(DISTINCT id(s)) as matched, count(t) as degreeout
WHERE 73 in s.job_id and degreeout <4
MATCH p=(s2:URL)-[r:VISITED*]-(t2:URL)
WHERE id(s2) in matched and length(p) >=1
RETURN p
Whenever I execute the query, the machine keeps processing and then I get an error no enough memory.
It seems like there is an infinite loop !!