Path Traversal and Node Extraction

Hello Room!

I have a Cypher query written which returns a path between (nodea) and (nodeb) so it starts at nodea and ends at nodeb and traverses a multi-level path through different nodes and different relationships, so a structure like:

(nodea)-[rela]-(nodeaa)-[relb]-(nodecc)-[relc]-(nodeb)

Now I can return all nodes in the path like:

match path=(nodea)-[rela]-(nodeaa)-[relb]-(nodecc)-[relc]-(nodeb)

But I have an optional match I need to apply to nodeaa, nodecc and nodeb to extract information that may or may not exist on a child node of that.

Now I understand Neo4J would take the shortest path between nodea and nodeb, but I was wondering if it was possible to extract certain node labels in a path and then perform an optional path on them?

Just to add, the path is important as its a hierarchical tree structure.

could you please share your query . So ,we can make changes to that to help you achieve the results you wish .