cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

How to return all end nodes of a tree?

What is the best way to get all the end nodes of a tree? Can it be achieved with a pure cypher or apoc function?
I've thought that I can return all of them based on the fact they don't have any outcoming relationships. Would it be possible?

1 ACCEPTED SOLUTION

Hi @marcelix161 ,

You can execute a pure cypher query like

MATCH(:root {//root condition})-[:MINST*]->(leaf)
where not (leaf)-[:MINST]->()
return leaf

Bennu

Oh, y’all wanted a twist, ey?

View solution in original post

1 REPLY 1

Hi @marcelix161 ,

You can execute a pure cypher query like

MATCH(:root {//root condition})-[:MINST*]->(leaf)
where not (leaf)-[:MINST]->()
return leaf

Bennu

Oh, y’all wanted a twist, ey?