cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Complex filter

Hi,
What is the most efficient way to match all path that contains node with label a, b or c but which can contains other type of nodes.
For example :
a -> b -> c must be matched
a -> b -> d -> c must be matched
a -> b -> d no match
a -> b no match

Any idea ?
I did it with with

MATCH (a)
WHERE exist((a)-->(b)) and exist((a)-->(c))

But i have performance issue.
Thank's

1 REPLY 1

Hi @gautier.wojda

Are a, b, and c labels, or not labels?

I created these nodes.

Light Blue: a
Blue: b
Orange: c
Red: d

If they are labels, then the following two lines should look like this
a -> b -> c must match
a -> b -> d -> c must match

MATCH (a:a)-->(b:b)-->(c:c),
      (b)-->(d:d)-->(c)
RETURN *

I'm not sure what your question means, but can it help?