Hi @powlinett!
An interesting query
I don’t have a clear idea of rewriting right now because I’m not sure what’s the goal.
The main problem is that Memgraph doesn’t support paths in expressions yet. In general, these filters containing paths might be rewritten using OPTIONAL MATCH + WITH, but in this case, that might be very verbose because of the variable length path. Another idea I have is to use Memgraph’s variable-length filtering expression, so, e.g., here https://docs.memgraph.com/memgraph/reference-overview/graph-algorithms#breadth-first-search, in the query:
MATCH (a {id: 723})-[*bfs..10 (e, n | e.x > 12 AND n.y < 3)]-() RETURN *;
part
e.x > 12 AND n.y < 3
is the filter on each node (n
) / edge (e
), maybe that could be used to achieve a similar thing. NOTE: variable-length path doesn’t have to be bfs
, standard dfs
(only *
, also can have the filter).
Could you write down in plain English what the query has to achieve? I’ll try to write an alternative query 