Homophily in a network according to scalar characteristics (connectivity degree, age, income, …) or enumerative characteristics (race, gender, …) can be measured easily in the Wolfram Language.
A friendship network at a high school with vertices color coded by race:
Highly social students are friends with other highly social students:
Measure the tendency for students to associate with others of the same race: