liveBook · Manning

Homophily

As explained in Knowledge Graphs and LLMs in Action

Homophily is the tendency of connected or socially associated entities to share similar characteristics or group affiliations.

Homophily is the tendency for connected nodes to share interests, attributes, behaviors, or group affiliations. It makes graph data relational rather than i.i.d., so node classification must combine node features with neighborhood structure. section 9.2.1

For classification, homophily turns social context into features: a node’s group membership is treated as likely related to the affiliations of its neighbors. This can capture patterns that total degree or generic embeddings miss. section 9.3.1

A practical homophily-aware node-classification pipeline is:

  • Represent each node with total degree plus counts of neighbors in relevant groups. section 9.3.1

Karate club classification

A karate club graph labels nodes by their eventual club affiliation. Degree-only vectors produce an f-score of about 0.43, while Node2Vec reaches about 0.64. Replacing these with total degree, Mr. Hi degree, and officer degree raises the reported f-score to about 0.93, illustrating the value of domain-informed homophily features.

How Knowledge Graphs and LLMs in Action covers it

How deep it goes
Explains homophily from definition through feature construction and measured classification results, without deriving its mathematical basis.
Examples
Demonstrates karate club affiliation prediction with degree, Node2Vec, and three degree-based node vectors.
What it assumes
Assumes graphs, node neighborhoods, labels, and basic classification, while making relational dependence explicit.
What you can do after
Apply it via NetworkX feature construction and logistic regression to classify graph nodes using neighborhood affiliations.
How it connects
Connects homophily with node classification, node embeddings, feature engineering, heterophily, structural equivalence, and i.i.d. assumptions.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Knowledge Graphs and LLMs in Action. The section links point to the parts of the book it draws on.