Returning Nth degree related nodes

Check if this example works for you.

{

 rootCategories(func: type(Category)) @filter(NOT has(~IncomingCategory)) {
    uid
    name
    CD as childCategory
  }
# "not has Incoming Category" means that this will fetch only "root category" or "no parents"
    
 B as var(func: uid(CD)) @recurse { 
    uid
    name
    C as someConnection #more childs?
  }
#this will expand in the "child" from the "root" starting from the 2nd level.

  listOfChilds(func: uid(B, C)) { # added C just in case
    uid
    name
    otherPredicate
    otherPredicate2
  }
# This above will list, kind of "flattened", all child found.
}

This will return a list of root categories. And also a list of children starting from the 2nd level in a flattened way.