Hi

I’m trying to implement the **constrained GAT** model described here. The authors describe two margin-based loss functions, one on the graph structure (Equation 1)

and one on class boundaries (Equation 2)

where \phi(v_{i},v_{j}) is the attention function LeakyReLU(MLP(v_{i}, v_{j})) between source node i and destination node j. Equation 1 encourages adjacent nodes to have larger attention values than distant nodes. Equation 2 encourages adjacent nodes with the same label to have larger attention values than adjacent nodes with different labels.

For a single source node i, the authors compute all pairwise differences in attention values and then sum the differences, rather than summing up the positive and negative attention values and then taking the difference in sums.

I’m a bit stuck on how to implement this pairwise difference step – given the `GATConv`

layer, the unnormalized attention values `e`

are already messages on edges between a source node and its adjacent destination nodes. The pairwise differences might be possible if we compute the edge graph for a source node (or of the entire graph, really, but this might be exceptionally large) – i.e. treat all edges incident on a source node as adjacent nodes in the edge graph. Does DGL offer some solution to this “comparison of messages” problem already?

Thanks.

k