The query will probably run faster if you leave off the `[*]` bit:

MATCH (n)
WHERE NOT (n)--()
RETURN n;

--
Chris Vest
System Engineer, Neo Technology
[ skype: mr.chrisvest, twitter: chvest ]


> On 28 Jan 2015, at 11:15, Linus Nikander <[email protected]> wrote:
> 
> That was easy enough, thank you.
> 
> Although I did have to change it slightly to:
> 
> MATCH (n)
> WHERE NOT (n)-[*]-()
> RETURN n;
> 
> since r wasn't defined.
> 
> 
> 
> On Tuesday, January 27, 2015 at 2:50:01 PM UTC+1, Aru Sahni wrote:
> MATCH (n)
> WHERE NOT (n)-[r]-()
> RETURN n;
> 
> On Tue, Jan 27, 2015 at 8:45 AM, Linus Nikander <[email protected] 
> <javascript:>> wrote:
> I want to identify all nodes without relationships to other nodes (orphans). 
> I can find some query examples but they only seem to work with legacy 
> versions of neo4j. Is there an easy way to accomplish this?
> 
> I've tried getting the following old query to work but haven't succeeded so 
> far:
> 
> 
>> START root=node(0), n=node(*)
>> where not(shortestPath(n-[*..2]-root))
>> RETURN n
> 
> A re-write of the above query or one that accomplishes the same would be 
> perfect. 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Neo4j" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] <javascript:>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Neo4j" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
You received this message because you are subscribed to the Google Groups 
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to