In some cases, it is legitimate to assume the following:
More popular people are more likely to be linked to other popular people.
In these cases, the preferential attachment method has to be used. The preferential attachment score of nodes u and v is equal to the product of the degrees of nodes u and v:
score(u, v) = | N(u) | × | N(v) |
This score is also implemented in the GDS plugin under the gds.alpha.preferentialAttachment function:
MATCH (u), MATCH (v)
RETURN id(u), id(v),
gds.alpha.linkprediction.preferentialAttachment(u, v, {
relationshipType: "REL",
direction: "BOTH"
})
Note that we can optionally specify the type and direction of the relationships we use to find the neighborhood. We will look at an example application in the following section.