Alternative paths

I put in dgraph the tree presented users and groups (and groups in groups etc). Whether exist method to find all alternative paths from some user to the final leaf? - I try to understand is it possible to use dgraph to find redundant access groups.

Have you tried https://dgraph.io/docs/query-language/kshortest-path-quries/#k-shortest-path-queries?