Expand query and filter by degree


I’m new to dgraph and consider it as a replacement of neo4j.
I have a network graph with ip addresses and domains. The schema looks like this:

type Domain {

type IP {

I want to traverse a graph and check the degree (a number of edges connected to a node) of each vertex on every step. If some vertex has the degree exceeding the threshold value it must not be expanded.
When I use just one predicate (<has_a_record> for instance) the query is straightforward:

	find(func: eq(name, "google.com")) @recurse(depth: 5, loop: false)  {
    		has_a_record @filter(lt(count(~has_a_record), 100))
    		~has_a_record @filter(lt(count(has_a_record), 100))

But I want to use all predicates of a type. Expand query seemed suitable but the documentation says that the result of this query can only be filtered by a node type.

It is possible to mention all the predicates in a query:

	f(func: eq(name, "google.com")) @recurse(depth: 5, loop: false)  {

		~has_parent @filter(lt(count(has_parent), 100))

		has_a_record @filter(lt(count(~has_a_record), 100))
		~has_a_record @filter(lt(count(has_a_record), 100))
		has_aaaa_record @filter(lt(count(~has_aaaa_record), 100))
		~has_aaaa_record @filter(lt(count(has_aaaa_record), 100))
		has_ns_record @filter(lt(count(~has_ns_record), 100))
		~has_ns_record @filter(lt(count(has_ns_record), 100))
		has_mx_record @filter(lt(count(~has_mx_record), 100))
		~has_mx_record @filter(lt(count(has_mx_record), 100))
		has_ptr_record @filter(lt(count(~has_ptr_record), 100))
		~has_ptr_record @filter(lt(count(has_ptr_record), 100))

However, it is not a convinient approach. And moreover it counts a degree considering only one predicate.

Is there an another method?

you could use expand(Domain) but the issue is that you can’t use filters with it tho.