Adamic Adar

Supported Graph Characteristics

Unweighted edges

Homogeneous vertex types

Heterogeneous vertex types

Algorithm link: Adamic Adar

The Adamic/Adar index is a measure according to the number of shared links between two vertices. It is defined as the sum of the inverse logarithmic degree centrality of the neighbors shared by the two vertices.

\[{A(x,y)=\sum _{u\in N(x)\cap N(y)}{\frac {1}{\log {|N(u)|}}}}\]

Where \({N(u)}\) is the set of vertices adjacent to u.

This algorithm was created in 2003 by Lada Adamic and Eytan Adar.

Notes

This algorithm ignores edge weights.

Specifications

CREATE QUERY tg_adamic_adar(VERTEX a, VERTEX b, SET<STRING> e_type)

Parameters

Name Description Default value

VERTEX a

The first vertex to compare.

N/A

VERTEX b

The second vertex to compare with the first.

N/A

SET<STRING> e_type

Edge types to traverse.

(A blank set of strings)

Output

Returns Adamic Adar index between the two given vertices. If the two vertices do not have common neighbors, the algorithm will return a division by 0 error.

Time complexity

The algorithm has a time complexity of \(O(D1 + D2)\), where \(D1\) and \(D2\) are the degrees of the two vertices.

Example

Suppose we have the graph below:

adamic adar ex

Running the algorithm between Jenny and Dan will give us a result of \(1/\log(2) = 3.32193\).

  • Query

  • Result

RUN QUERY adamic_adar (("Jenny", "person"), ("Dan", "person"), ["friendship"])
{
    "error": false,
    "message": "",
    "version": {
    "schema": 1,
    "edition": "enterprise",
    "api": "v2"
    },
    "results": [{"@@closeness": 3.32193}]
}