Supported Graph Characteristics
 Unweighted edges Homogeneous vertex types Heterogeneous vertex types

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.

## Notes

This algorithm ignores edge weights.

## Specifications

``CREATE QUERY tg_adamic_adar(VERTEX v_source VERTEX v_target, SET<STRING> e_type)``

### Parameters

Name Description Default value

`VERTEX v_source`

The first vertex to compare. Provide the vertex ID and type as a tuple: `("id","type")`

N/A

`VERTEX v_target`

The second vertex to compare with the first. Provide the vertex ID and type as a tuple: `("id","type")`

N/A

`SET<STRING> e_type_set`

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: 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}]
}``````