We use WITH clause for the dynamic behavior and passing the result to the next query.
If you specify in the relationship along with WITH clause, the relationship values are passed, and with that you can easily get the connected nodes. Even the -[]->
can be called for the relationship needed. All of this can be performed dynamically.
I have done this many times for many complex queries.