Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

filter path based on decorating node

I have the following graph

[a1:A]->[b1:B]->[c1:C]->[d1:D]

[a2:A]->[b2:B]->[c2:C]->[d2:D]
                  ^
                  |
                  [x1:X]

If I use the query

match p=((:A)-[*]->(:D))

then it returns both path above, but I want to filter the second path out because there is a label X node pointing to node C. What is the query to use that returns only the path that does not contain nodes that are decorated by node label X.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You could try this

MATCH p=((:A)-[*]->(:D))
WHERE NONE(node IN nodes(p) WHERE EXISTS((node)<--(:X))  )
RETURN p
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading