liveBook · Manning

Node similarity algorithm

As explained in Graph Algorithms for Data Science

A node similarity algorithm computes similarity scores or relationships between graph nodes from shared or comparable structural features.

A node similarity algorithm compares nodes through their neighbors. In a bipartite network, it typically compares one node type—such as users or tweets—using the other type as the comparison set. Jaccard similarity divides the intersection of two neighbor sets by their union; the algorithm can also use the overlap coefficient. section 7.2.2

A practical GDS workflow involves:

  • Project the graph with the intended relationship orientation. For tweet–tag data, reverse HAS_TAG so tweets are compared by the tags they point to conceptually, rather than comparing tags by shared tweets. section 7.2.2
  • Use stats mode to inspect nodesCompared, similarityPairs, and the similarityDistribution before creating a dense inferred network. section 7.7
  • Apply similarityCutoff to retain only relationships above a chosen similarity threshold, then use topK when limiting similar relationships per node. section 7.7

From hashtags to co-occurrence

Suppose tweets connect to hashtag nodes through HAS_TAG. Projecting reversed HAS_TAG relationships lets the algorithm compare tweets by shared hashtags. A Jaccard cutoff of 0.33 reduces the observed similarity pairs from 13,402 to 7,733 in the illustrated distribution; the retained similarities can then be mutated as CO_OCCURRENCE relationships.

How Graph Algorithms for Data Science covers it

How deep it goes
Descends from set-based similarity to projection direction, distribution statistics, cutoffs, and in-memory mutation.
Examples
Uses users and musical genres, tweets and hashtags, similarity distributions, and mutated CO_OCCURRENCE relationships.
What you can do after
Operate/configure GDS node similarity to project relationships, inspect density, filter scores, and write inferred similarity edges.
How it connects
Connects bipartite networks, Jaccard similarity, overlap coefficient, graph projection, and co-occurrence networks.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Graph Algorithms for Data Science. The section links point to the parts of the book it draws on.