Ooker
Ooker

Reputation: 3076

Is it possible to match paths between two lists of nodes?

I try:

match (a1 {name: "a1"}) match (a2 {name: "a2" }) 
with [a1,a2] as A
match (b1 {name: "b1" }) match (b2 {name: "b2"}) 
with A,[b1,b2] as B
match p=A--B
return p

But it doesn't work.

How should I tell it to find any path between the two groups? Yes I can try individual pair of nodes, but the number of combinations I need to try is huge. The Neo4j Cypher Manual of Cypher path matching and Lists don't help me on this.

Upvotes: 0

Views: 20

Answers (1)

Graphileon
Graphileon

Reputation: 5385

What about changing the last part of your query to

match p=(A)—(n)
Where n IN B
return p 

Upvotes: 1

Related Questions