The graph object to calculate the cosine similarity
Execute the Similarity algorithm between two nodes.
Execute the Similarity algorithm between two nodes.
current node ID
another node ID to check the similarity with current node
direction of edges in Directed Graph
Similarity score of two nodes
Iterate over each node in the graph and get top k
nodes with non-zero similarity
score for each node.
Iterate over each node in the graph and get top k
nodes with non-zero similarity
score for each node.
limit for similar nodes
direction of edges in Directed Graph
Map with key as node Id and value as Seq of top k
similar node ids and
similarity score.
Iterate over graph nodes and calculate similarity scores for each node.
Iterate over graph nodes and calculate similarity scores for each node. If the graph stores edges in
both in and out direction, then iterate over the neighbors in reverse dir
of neighbors of node u
.
current node ID
limit for similar nodes
direction of edges in Directed Graph
Seq of top k
similar node ids and their similarity score with node u
.
Nodes with non-zero score are added. So, the length of the Seq can be less than k
The graph object to calculate the cosine similarity
The graph object to calculate the cosine similarity
Calculate cosine similarity for a specific graph. Cosine Similarity of two nodes is the size of their common neighbors divided by the geometric mean of their degrees