Based on the first part of your question, I think Recurse Query is a good option.
me(func: eq(address, "0x13b0e7e1d01b2678659a83a3d83fb60e1e594892"))
@recurse(depth: 15, loop: true) {
from
timestamp
to
address
}
https://docs.dgraph.io/query-language/#recurse-query
But I did not quite understand the second part. But I make it clear that you can use filters with Recurse Query. However below is a link to k-shortest-path-queries. That may be useful.
https://docs.dgraph.io/query-language/#k-shortest-path-queries
Anything I’m around.
Cheers.