Cypher pattern start node is in list

Using the default movies graph I want to compute:

MATCH p=(n:Movie {title:  ["The Matrix Reloaded", "The Devil's Advocate"]})-[*]-() 
RETURN p 
LIMIT 25

However, I am not sure how to specify the title is in list operation.

Potentially: apoc.coll.contains(coll, value) is useful? Lists - Cypher Manual also mentions a pattern comprehension, but so far it is unclear for me how to apply the is in list operation.

MATCH p=(n:Movie)-[*]-() 
WHERE ANY(item IN ["The Matrix Reloaded", "The Devil's Advocate"] WHERE item = n.title)
RETURN p 
LIMIT 25

seems to be possible - but really slow.

Basically I want to have an all shortest paths - but the start point is a move from the list - however, the destination/end point must be a wildcard.

Hello @georg_kf_heiler :slight_smile:

MATCH (n:Movie)
WHERE n.title IN ["The Matrix Reloaded", "The Devil's Advocate"]
WITH n
MATCH p=(n)-[*]-()
RETURN p
LIMIT 25

Regards,
Cobra

2 Likes