Link prediction error

Hi everyone.

I’m following this tutorial for link prediction: Link Prediction using Graph Neural Networks — DGL 0.6.1 documentation

I have a graph with this shape:

Graph(num_nodes=33786, num_edges=69192,
ndata_schemes={‘Type’: Scheme(shape=(3,), dtype=torch.float32)}
edata_schemes={‘Type’: Scheme(shape=(3,), dtype=torch.float32)})

When I try the link prediction code I get the following error:

adj_neg = 1 - adj.todense() - np.eye(g.number_of_nodes())
ValueError: operands could not be broadcast together with shapes (33784,33784) (33786,33786)

I dont get to know why there is this 2 nodes difference.

Any ideas?

Thank you.

Looks like your adj's shape is (33784, 33784) which is different from the graph’s number of nodes. How did you get adj?

1 Like

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