# Cypher has variable-length "line"-of-arrows matching, but does it have variable-size "grid" matching?

I know you can search for "any number of arrows" using Variable-length pattern matching

So that matches a "line of arrows" if you will, of any length.

But can you match a "grid of arrows" of any size, ie. a 2D grid, possibly even 3D if it can be done for 2D?

``````A -> B -> C -> ... -> D
|    |    |           |
V    V    V           V
A'-> B'-> C'-> ... -> D'
.    .    .           .
.    .    .           .
.    .    .           .
|    |    |           |
V    V    V           V
A''->B''->C''-> ... ->D''
``````

That is what I mean as a generalization of the 1D case, a 2D grid of any size. Where, for this question, each square in the grid is bounded by exactly 4 arrows or "sides".

If it Cypher doesn't directly support this, then what would be the most optimal way of implementing it using Neo4j's suite of technology?

So, if I understand correctly you want to get from A to B' by doing a 2-hop search from two directions (through B and through A')?

If this is the case, the variable-length pattern matching actually does that, it doesn't go just from A to B or from A to A' , exclusively, but from every relationship that A has.

Please let me know if this is useful or if you have more details for the case you want to solve!