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?

Hi @marcelix161 ,

You can execute a pure cypher query like

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

Bennu

2 Likes