Click4Ai

465.

Hard

Link Prediction

====================

In this problem, you will be implementing a link prediction model using a Graph Neural Network (GNN).

**Example:** Given a graph with nodes and edges, predict the likelihood of a new edge between two nodes.

**Constraints:** Use a GNN architecture with a message passing mechanism and a readout function to predict the likelihood of the new edge.

**Note:** You can assume the graph is represented as an adjacency matrix.

Test Cases

Test Case 1
Input: [[0, 1, 0], [1, 0, 1], [0, 1, 0]]
Expected: [0.5, 0.5, 0.5]
Test Case 2
Input: [[0, 0, 1], [0, 1, 0], [1, 0, 0]]
Expected: [0.5, 0.5, 0.5]
+ 3 hidden test cases