We are trying to write PGQL query to get multiple hop(s) for selected node.
To get nodes and edge for the selected node,
SELECT n0.id as n0id, e0.id as e0id, n1.id as n1id FROM MATCH (n0)->[e0]->(n1) WHERE n0.id=12345
To increase nodes and edges result, example 2 hops,
... FROM MATCH (n0)->[e0]->(n1)->[e1]->(n3) ...
However in this case, nodes with 1 hop will not be return.
I wonder if there is any way query required hop(s) for selected node?
Any solution would be appreciated.
It seems you are looking for the PGQL syntax for variable-length paths:
https://pgql-lang.org/spec/1.4/#variable-length-paths
Among these patterns, I suppose the reachability syntax is useful in your case.
https://pgql-lang.org/spec/1.4/#between-n-and-m
Thanks!