I have a database with nodes having (n)-[r]-(m) relationship. How to get all the top level nodes having no [Parent] relationship?

I am using the cypher
</>match (n:NodeEntity)
where not (n)<--(:NodeEntity)
return n</>
But this is also returning nodes which have a parent relationship..

I think you specified an inbound relationship when you should be using an outbound relationship for a parent

where not (n)<--(:NodeEntity)

This is the right way to express this, but this will return tree leaves not parents. Try reversing the arrow direction

Assuming data as follows:

Screen Shot 2022-03-22 at 12.48.34 PM

The following query worked:

match(n:NodeEntity)
where not exists ((:NodeEntity)-->(n))
return n

Screen Shot 2022-03-22 at 12.48.50 PM

if your relationships are in the other direction, flip the direction in the where pattern predicate, as @david_allen suggests.