Utilizing edge features for link prediction

I’m rather new to DGL, and I’ve been trying to modify the Link Prediction using Graph Neural Networks(Link Prediction using Graph Neural Networks — DGL 0.7.2 documentation) tutorial for my task of predicting links between adjacent elements in a 3D model - the elements are modelled as nodes, and connections between the elements are modelled as edges.

In the tutorial it says

The benefit of treating the pairs of nodes as a graph is that you can use the DGLGraph.apply_edges method, which conveniently computes new edge features based on the incident nodes’ features and the original edge features (if applicable).

I was wondering how one can have edge features in a link prediction task, as during prediction, the edges would not exist? Sorry if this is a rookie question and I’m missing something obvious.

The reason I ask is, I’ve been using the dot product and MLP predictors in the tutorial so far, with pretty bad results. One of my node features encodes the 3D position of the elements as a vector, which should be a pretty strong predictor of whether that element is linked to another in 3D space. Since the model isn’t performing well, I imagine that the model is not able to derive this logic. Therefore, I’ve been wondering if I could just encode Euclidean distance between two elements as an edge feature to help the model along. But since this is a link prediction task, I’m not sure how to achieve this for edges that technically don’t exist during inference. If there is a more intuitive way to achieve this purpose, suggestions would be very welcome.

I was wondering how one can have edge features in a link prediction task, as during prediction, the edges would not exist? Sorry if this is a rookie question and I’m missing something obvious.

The edge features here refer to the score assigned by a trained model to a pair of nodes. I agree this can be a bit confusing.

Therefore, I’ve been wondering if I could just encode Euclidean distance between two elements as an edge feature to help the model along.

Yes, you can do that by calculating the pairwise Euclidean distance. I don’t think it’s necessary to first construct a graph g from pairs of nodes and then invokes g.apply_edges.

1 Like

That makes sense, thanks so much,

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.