Reputation: 601
I want to get all paths between two nodes so that at least one node from a list of nodes exists in those paths.
how can I do this using cypher ?
Upvotes: 3
Views: 1871
Reputation: 9952
Assuming you have provided your list of nodes as a cypher collection, would this do the job?
MATCH path=(start)-[r:*1..100]-(end)
WHERE ANY(node_on_path in NODES(path)
WHERE node_on_path IN node_collection)
You may also try using a list of values against which the nodes on the path are checked, something like
MATCH path=(start)-[r:1..100]-(end)
WHERE ANY(node_on_path in NODES(path)
WHERE node_on_path.some_property IN list_of_acceptable_values)
Upvotes: 2