Adamic Adar
Adamic Adar is a measure used to compute the closeness of nodes based on their shared neighbors.
This algorithm is in the alpha tier. For more information on algorithm tiers, see Graph algorithms.
1. History and explanation
The Adamic Adar algorithm was introduced in 2003 by Lada Adamic and Eytan Adar to predict links in a social network. It is computed using the following formula:
where N(u)
is the set of nodes adjacent to u
.
A value of 0 indicates that two nodes are not close, while higher values indicate nodes are closer.
The library contains a function to calculate closeness between two nodes.
2. Syntax
RETURN gds.alpha.linkprediction.adamicAdar(node1:Node, node2:Node, {
relationshipQuery:String,
direction:String
})
Name | Type | Default | Optional | Description |
---|---|---|---|---|
|
Node |
null |
no |
A node |
|
Node |
null |
no |
Another node |
|
String |
null |
yes |
The relationship type used to compute similarity between |
|
String |
BOTH |
yes |
The relationship direction used to compute similarity between |
3. Adamic Adar algorithm sample
CREATE
(zhen:Person {name: 'Zhen'}),
(praveena:Person {name: 'Praveena'}),
(michael:Person {name: 'Michael'}),
(arya:Person {name: 'Arya'}),
(karin:Person {name: 'Karin'}),
(zhen)-[:FRIENDS]->(arya),
(zhen)-[:FRIENDS]->(praveena),
(praveena)-[:WORKS_WITH]->(karin),
(praveena)-[:FRIENDS]->(michael),
(michael)-[:WORKS_WITH]->(karin),
(arya)-[:FRIENDS]->(karin)
MATCH (p1:Person {name: 'Michael'})
MATCH (p2:Person {name: 'Karin'})
RETURN gds.alpha.linkprediction.adamicAdar(p1, p2) AS score
score |
---|
0.9102392266268373 |
We can also compute the score of a pair of nodes based on a specific relationship type.
FRIENDS
relationships: MATCH (p1:Person {name: 'Michael'})
MATCH (p2:Person {name: 'Karin'})
RETURN gds.alpha.linkprediction.adamicAdar(p1, p2, {relationshipQuery: 'FRIENDS'}) AS score
score |
---|
0.0 |
Was this page helpful?