get all top to bottom neo4j hierarchy code example
Example: get topmost parent in neo4j hierarchy
MATCH (Segment1)-[:Leaf]->(Op1)-[:Account]->(Ac2)-[*:Parent]->(Acc)
WHERE NOT (Acc)-[:Parent]->()
RETURN Acc;
MATCH (Segment1)-[:Leaf]->(Op1)-[:Account]->(Ac2)-[*:Parent]->(Acc)
WHERE NOT (Acc)-[:Parent]->()
RETURN Acc;