Using Normalise on larger set

What I want to do

I am trying to do all ancestor listings for searched node and need to display the child for my ancestors during the search.

I see a lot of nodes get duplicated (due to nature of data , ancestor being parent of multiples and cross parentship from different chains and wanted to use the normalize directive.

What I did

I ran this query

{
  q(func: eq(Batch, "B1" )                          
) @filter(eq(Plant, "Plant1") and eq(Material,"M1))
      
  @recurse (depth:5) @normalize


   {
   
   
   #uid
   
    
   # child 
    expand(_all_)
    parent:~child {}
    #child {}
    
    
    
    
  }
}

I get error on using normalize

while running ToJson: Couldn't evaluate @normalize directive - too many results"

I see the results are large due to the reason the way the parents have multiple childs and childs getting multiple times related to other branches

This error does not come for all datasets , it seems to appear only in some cases.
Now the challenge is transmitting such duplicated structure means lots of compute/io on all ends (both client and server). This is not sustainable.

There is heavy cpu usage due to probably unoptimized query,

Any advise on how to deal with this in optimized manner is very much appreciated.

Dgraph metadata

type <BatchNode> {
	Plant
	Material
	Batch
	DocumentType
	child
	Quantity
	UoM
}
type <OrderNode> {
	DocumentNo
	DocumentType
	ProductionOrder
	PurchaseOrder
	Vendor
	child
}

it is order nodes which are top most parents for batch nodes

dgraph version Dgraph V21.03.0
--limit 
normalize-node=10000; The maximum number of nodes that can be returned in a query that uses the normalize directive.

you can increase this limit in alpha flags. you can use more filters if your use case permits it to limits the resulting nodes or can use pagination to get portion of result.
https://dgraph.io/docs/query-language/pagination/#sidebar
https://dgraph.io/docs/query-language/recurse-query/#sidebar
@naman any more ideas ?