In order to make predictions using a link prediction score, we need to follow these steps:
- Define the state of the graph at a given time, t1
- At time t1, compute the link prediction score for each pair of nodes in the graph
- Compare these predictions to the links created between t1 and t2
- Determine a score threshold such that pairs with a score above this threshold are more likely to appear at time t2 > t1
In this example, the state of the graph at t1 is already provided through the KNOWS_T1 relationships.
We can now compute the link prediction score for each pair of nodes in the graph, considering only the knowledge at time t1 by using the newly created relationship. Here, we choose to use the Adamic-Adar score:
MATCH (u) MATCH (v) WHERE u <> v
RETURN u.id as u_id,
v.id as v_id,
gds.alpha.linkprediction.adamicAdar(u, v, {
relationshipQuery: "KNOWS_T1",
direction: ...