Dear all,

I have a graph with weights on edges. My question is how to write a reduce function which gets the weighted average of neighbors where weights are on edges. I only know dgl has built-in reduce function “mean”, but how to get the weighted mean?

For example, one node has 3 neighbors with each neighbor has value 1 and edge weights: 1, 2, 3. Then the weighted average would be (1x1 + 1x2 + 1x3)/(1+2+3)

Many thanks!

Bo