Hello dear community,
I'm trying to construct a Cypher query, which returns a subgraph from a specific node with arbitrary depth. The only constraint is, that it shouldn't continue from or include any node with a certain label.
More specific in my example:
There is a specific node with label submission (let's call it x) and a few nodes {y} connected with direction to the submission node x. Now I want to get the whole subgraph of y while I don't want to have x or anything beyond it.
I have no information about node or edge labels which are included in the subgraph of y.
I tried the following:
match (x:submission)<--(y) where x.name="0A28VDC" call apoc.path.subgraphNodes(y, {labelFilter: "/submission"}) yield node return node,x,y
Problem: the labelfilter only returns subgraphs where the paths end at the node x. It would require something exluding submission and not searching beyond it, while including everything else. I couldn't find this functionality...
match (x:submission)--(y)-[ ]-(z) WHERE x.name="0A28VDC" AND NOT z:submission return x,y,z
Problem: somehow this query doesn't terminate, probably because any y and z continuously appear in the search again. The problem is, that the subgraph I want to return has connections of any direction...
Somebody maybe has an idea how to solve this?
I would be so happy for any answer!
Thank you and best wishes
Adrian