How can we find how many levels of a particular hierarchy exists?

Thanks for the reply! This did the job for me with some addition.

In the list object I got multiple objects data is like tree structure, so did groupby and calculated the max value.

schema:

<project>: uid @reverse .
<id>: string @index(hash) .
<name>: string .
<subsidiary>: [uid] @reverse .

type <Company> {
     id
    project
    name
    subsidiary
}
{
   var(func: uid(0x6241ae)) @recurse{
    a as uid
    name:name
    subsidiary 
  }
  var(func:uid(a)) @groupby(subsidiary) {
      c as count(uid)
  }
  res(){
      maxlevels :max(val(c))
  }
}

Let me know if you have any other optimal way to do this.