UltipaDocs
Try Playground
  • Introduction
    • Show Algorithms
    • Install and Uninstall
    • Run Algorithms
    • Algorithm Results and Statistics
    • Degree Centrality
    • Closeness Centrality
    • Harmonic Centrality
    • Graph Centrality
    • Betweenness Centrality
    • Eigenvector Centrality
    • CELF
    • PageRank
    • ArticleRank
    • HITS
    • SybilRank
    • Jaccard Similarity
    • Overlap Similarity
    • Cosine Similarity
    • Pearson Correlation Coefficient
    • Euclidean Distance
    • K-Hop All
    • Bipartite Graph
    • HyperANF
    • Connected Component
    • Triangle Counting
    • Induced Subgraph
    • k-Core
    • k-Truss
    • p-Cohesion
    • k-Edge Connected Components
    • Local Clustering Coefficient
    • Topological Sort
    • Schema Overview
    • Dijkstra's Single-Source Shortest Path
    • Delta-Stepping Single-Source Shortest Path
    • Shortest Path Faster Algorithm (SPFA)
    • Minimum Spanning Tree
    • Breadth-First Search (BFS)
    • Depth-First Search (DFS)
    • Adamic-Adar Index
    • Common Neighbors
    • Preferential Attachment
    • Resource Allocation
    • Total Neighbors
    • Louvain
    • Leiden
    • Label Propagation
    • HANP
    • k-Means
    • kNN (k-Nearest Neighbors)
    • K-1 Coloring
    • Conductance
      • Random Walk
      • Node2Vec Walk
      • Node2Vec
      • Struc2Vec Walk
      • Struc2Vec
      • GraphSAGE
      • GraphSAGE Train
      • LINE
      • Fast Random Projection
      • Summary of Graph Embedding
      • Gradient Descent
      • Backpropagation
      • Skip-gram
      • Skip-gram Optimization
  1. Docs
  2. /
  3. Graph Analytics & Algorithms
  4. /
  5. Topological Link Prediction

Adamic-Adar Index

✓ File Writeback ✕ Property Writeback ✓ Direct Return ✓ Stream Return ✕ Stats

Overview

The Adamic-Adar Index (AA Index) is a node similarity metric named after its creators Lada Adamic and Eytan Adar. This index measures the potential connection strength between two nodes based on the shared neighbors they have in the graph.

  • L.A. Adamic, E. Adar, Friends and Neighbors on the Web (2003)

The underlying idea of the AA Index is that common neighbors with low degree provide more valuable information about the similarity between two nodes than common neighbors with high degrees. It is computed using the following formula:

where N(u) is the set of nodes adjacent to u. For each common neighbor u of the two nodes, the AA Index first calculates the reciprocal of the logarithm of its degree |N(u)|, then sums up these reciprocal values for all common neighbors.

Higher AA Index scores indicate greater similarity between nodes, while a score of 0 indicates no similarity between two nodes.

In this example, N(D) ∩ N(E) = {B, F}, where 1log|N(B)| = 1log4 = 1.6610, 1log|N(F)| = 1log3 = 2.0959, thus AA(D,E) = 1.6610 + 2.0959 = 3.7569.

Considerations

  • The AA Index algorithm ignores the direction of edges but calculates them as undirected edges.

Syntax

  • Command: algo(topological_link_prediction)
  • Parameters:
Name
Type
Spec
Default
Optional
Description
ids / uuids[]_id / []_uuid//NoID/UUID of the first set of nodes to calculate; each node in ids/uuids will be paired with each node in ids2/uuids2
ids2 / uuids2[]_id / []_uuid//NoID/UUID of the second set of nodes to calculate; each node in ids/uuids will be paired with each node in ids2/uuids2
typestringAdamic_AdarAdamic_AdarYesType of similarity; for AA Index, keep it as Adamic_Adar
limitint>=-1-1YesNumber of results to return, -1 to return all results

Example

The example graph is as follows:

File Writeback

SpecContent
filenamenode1,node2,num
UQL
algo(topological_link_prediction).params({
  uuids: [3],
  uuids2: [1,5,7]
}).write({
  file:{ 
    filename: 'aa'
  }
})

Results: File aa

File
C,A,1.660964
C,E,3.321928
C,G,2.095903

Direct Return

Alias OrdinalType
Description
Columns
0[]perNodePairNode pair and its similaritynode1, node2, num
UQL
algo(topological_link_prediction).params({
  ids: 'C',
  ids2: ['A','C','E','G'],
  type: 'Adamic_Adar'
}) as aa 
return aa 

Results: aa

node1node2num
311.66096404744368
353.32192809488736
372.09590327428938

Stream Return

Alias OrdinalType
Description
Columns
0[]perNodePairNode pair and its similaritynode1, node2, num
UQL
find().nodes() as n
with collect(n._id) as nID
algo(topological_link_prediction).params({
  ids: 'C',
  ids2: nID
}).stream() as aa
where aa.num >= 2
return aa

Results: aa

node1node2num
343.75686732173307
353.32192809488736
372.09590327428938