I am trying to query a graph to return all of the paths with a set of specified relationships.
The graph I have contains the following nodes: Person
The relationships which connect two people are: knows, married
So an example of some data are:
c:Person-[:knows]->b:Person
a:Person-[:married]->c:Person
d:Person-[knows]-> a:Person
In my query I would like to be able to find all paths that contain both relationships 'knows' and 'married'; however, I don't care about the ordering of such relationships in the paths. For example, my query should return the following paths:
1) a:Person-[:married]->c:Person-[:knows]->b:Person
2) d:Person-[:knows]->a:Person-[:married]->c:Person
I tried the following query
MATCH p=(a)-[:KNOWS|MARRIED*1..3]-(b)
RETURN p
However, it returned the paths only having knows relationship or the paths only having married relationship, but not both.
Is there any way of finding the paths I want? Many thanks!